Pisa 2012 Data Exploration

by Youssef Ahmed Khattab

This NoteBook will be devoted to investigating subtleties of the PISA 2012 dataset. PISA, specifically, is a "overview of understudies' abilities and information as they approach the finish of obligatory schooling. It's anything but a traditional school test. As opposed to analyzing how well understudies have taken in the school educational plan, it sees how solid and steady they are for life beyond school"

Within this datset we can find information around 510 000 students between the ages of 15 years 3 months and 16 years 2 months participated in PISA 2012 as a whole representing about 28 million 15-year-olds globally.

Throughout the course of this notebook I will have these two questions in mind:

  • Are there contrasts in accomplishment dependent on gender or parental education levels?
  • Is there a connection between the measure of time a student dedicates to learning and their score?

Preliminary Wrangling

To begin, let's start off by assessing the dataset and cleaning any remaining issues.

In [1]:
# import all packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb

%matplotlib inline
In [2]:
pisa = pd.read_csv('pisa_wrg.csv')
pisa.head()
Out[2]:
Country Student ID Gender Out-of-School Study Time - Homework Out-of-School Study Time - Guided Homework Out-of-School Study Time - Personal Tutor Out-of-School Study Time - Commercial Company Out-of-School Study Time - With Parent Learning Time - Mathematics Learning Time - Test Language Learning Time - Science Average_Math_Score Average_Reading_Score Average_Science_Score Average_Total_Score Education - Father Education - Mother Out-of-School Study Time - Total Learning Time - Total
0 Italy 4711 Female 22.0 2.0 0.0 0.0 0.0 220.0 220.0 110.0 546.58826 600.74068 542.83850 563.389147 Bachelor’s or equivalent Bachelor’s or equivalent 24.0 550.0
1 Italy 4508 Male 9.0 2.0 1.0 0.0 1.0 232.0 348.0 232.0 546.82192 530.94960 580.79074 552.854087 Bachelor’s or equivalent Bachelor’s or equivalent 13.0 812.0
2 Italy 4473 Male 13.0 2.0 0.0 0.0 2.0 200.0 450.0 100.0 614.20002 661.18546 667.60536 647.663613 Bachelor’s or equivalent Bachelor’s or equivalent 17.0 750.0
3 Italy 4460 Female 18.0 0.0 0.0 0.0 1.0 200.0 250.0 100.0 646.83754 701.85636 705.83738 684.843760 Bachelor’s or equivalent Bachelor’s or equivalent 19.0 550.0
4 Italy 3971 Male 21.0 0.0 0.0 0.0 10.0 180.0 240.0 120.0 550.32716 621.08820 688.86610 620.093820 Bachelor’s or equivalent Bachelor’s or equivalent 31.0 540.0

Evaluating and Cleaning the data

In [3]:
pisa.shape
Out[3]:
(24168, 19)
In [4]:
pisa.dtypes
Out[4]:
Country                                           object
Student ID                                         int64
Gender                                            object
Out-of-School Study Time - Homework              float64
Out-of-School Study Time - Guided Homework       float64
Out-of-School Study Time - Personal Tutor        float64
Out-of-School Study Time - Commercial Company    float64
Out-of-School Study Time - With Parent           float64
Learning Time - Mathematics                      float64
Learning Time - Test Language                    float64
Learning Time - Science                          float64
Average_Math_Score                               float64
Average_Reading_Score                            float64
Average_Science_Score                            float64
Average_Total_Score                              float64
Education - Father                                object
Education - Mother                                object
Out-of-School Study Time - Total                 float64
Learning Time - Total                            float64
dtype: object
In [5]:
pisa.sample(10)
Out[5]:
Country Student ID Gender Out-of-School Study Time - Homework Out-of-School Study Time - Guided Homework Out-of-School Study Time - Personal Tutor Out-of-School Study Time - Commercial Company Out-of-School Study Time - With Parent Learning Time - Mathematics Learning Time - Test Language Learning Time - Science Average_Math_Score Average_Reading_Score Average_Science_Score Average_Total_Score Education - Father Education - Mother Out-of-School Study Time - Total Learning Time - Total
1607 United Arab Emirates 11043 Female 28.0 16.0 7.0 4.0 7.0 250.0 250.0 200.0 453.50522 511.06306 438.95936 467.842547 Bachelor’s or equivalent Bachelor’s or equivalent 62.0 700.0
15299 Spain 14599 Female 2.0 0.0 0.0 0.0 0.0 180.0 180.0 135.0 458.64618 472.53904 454.53190 461.905707 Lower secondary Post-secondary 2.0 495.0
21104 Italy 28691 Female 2.0 2.0 0.0 0.0 2.0 240.0 360.0 120.0 382.46614 418.44652 427.76948 409.560713 Primary Lower secondary 6.0 720.0
19638 Finland 5584 Male 1.0 0.0 0.0 0.0 0.0 120.0 180.0 120.0 523.45382 478.82314 496.86684 499.714600 Short-cycle tertiary Upper secondary 1.0 420.0
12726 Canada 18142 Male 5.0 4.0 1.0 1.0 0.0 375.0 375.0 300.0 582.73096 560.78194 550.11188 564.541593 Upper secondary Short-cycle tertiary 11.0 1050.0
17941 Canada 12609 Female 8.0 1.0 0.0 0.0 0.0 408.0 408.0 408.0 594.49288 619.00982 611.56284 608.355180 Post-secondary Upper secondary 9.0 1224.0
12846 Canada 16481 Male 2.0 2.0 0.0 0.0 0.0 450.0 450.0 450.0 494.39944 523.09052 530.34312 515.944360 Lower secondary Short-cycle tertiary 4.0 1350.0
23238 Romania 3662 Female 5.0 2.0 0.0 0.0 0.0 240.0 350.0 150.0 403.57532 470.15612 439.23910 437.656847 Bachelor’s or equivalent Lower secondary 7.0 740.0
2805 Iceland 2589 Female 1.0 1.0 0.0 0.0 1.0 200.0 240.0 80.0 591.06558 631.24218 601.49198 607.933247 Bachelor’s or equivalent Short-cycle tertiary 3.0 520.0
16014 Brazil 1886 Male 3.0 2.0 1.0 2.0 1.0 150.0 100.0 80.0 367.04314 396.62378 424.03952 395.902147 Bachelor’s or equivalent Upper secondary 9.0 330.0
In [6]:
pisa.describe()
Out[6]:
Student ID Out-of-School Study Time - Homework Out-of-School Study Time - Guided Homework Out-of-School Study Time - Personal Tutor Out-of-School Study Time - Commercial Company Out-of-School Study Time - With Parent Learning Time - Mathematics Learning Time - Test Language Learning Time - Science Average_Math_Score Average_Reading_Score Average_Science_Score Average_Total_Score Out-of-School Study Time - Total Learning Time - Total
count 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000 24168.000000
mean 13106.692486 6.811610 1.412777 0.758358 0.587347 0.971946 238.321706 242.401399 209.072782 519.257862 519.784153 525.112430 521.384815 10.542039 689.795887
std 8294.946498 5.984246 2.486527 1.807041 1.759952 2.024808 85.956337 89.875466 127.052213 88.623659 86.642298 86.234264 83.650569 9.291804 238.369871
min 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 130.059220 113.136180 144.479680 142.355407 0.000000 0.000000
25% 6043.750000 2.000000 0.000000 0.000000 0.000000 0.000000 180.000000 180.000000 120.000000 457.789380 464.584075 467.120475 465.328405 4.000000 550.000000
50% 12251.500000 5.000000 1.000000 0.000000 0.000000 0.000000 225.000000 225.000000 180.000000 520.727520 524.774600 528.757920 524.411097 8.000000 650.000000
75% 19559.250000 10.000000 2.000000 1.000000 0.000000 1.000000 275.000000 275.000000 275.000000 580.861505 580.644640 585.919420 580.062088 14.000000 770.000000
max 31071.000000 30.000000 30.000000 30.000000 30.000000 30.000000 1260.000000 1530.000000 2250.000000 891.969140 793.916900 834.800440 820.856000 150.000000 2970.000000
In [7]:
pisa['Education - Father'].value_counts()
Out[7]:
Short-cycle tertiary        9987
Bachelor’s or equivalent    5639
Upper secondary             3267
Lower secondary             2385
Post-secondary              2300
Primary                      464
Early childhood              126
Name: Education - Father, dtype: int64
In [8]:
pisa['Education - Mother'].value_counts()
Out[8]:
Short-cycle tertiary        10185
Upper secondary              4791
Lower secondary              3057
Bachelor’s or equivalent     2725
Post-secondary               2646
Primary                       588
Early childhood               176
Name: Education - Mother, dtype: int64
In [9]:
# Convert level of education into ordered categorical
ordinal_var_dict = {'Education - Father': ['Early childhood', 'Primary', 'Lower secondary', 'Upper secondary', 'Post-secondary', 'Short-cycle tertiary', 'Bachelor’s or equivalent'],
                    'Education - Mother': ['Early childhood', 'Primary', 'Lower secondary', 'Upper secondary', 'Post-secondary', 'Short-cycle tertiary', 'Bachelor’s or equivalent']}

for var in ordinal_var_dict:
    ordered_var = pd.api.types.CategoricalDtype(ordered = True,
                                                categories = ordinal_var_dict[var])
    pisa[var] = pisa[var].astype(ordered_var)
In [10]:
pisa['Student ID'].duplicated().sum()
Out[10]:
0
In [11]:
pisa.drop_duplicates(inplace=True)
In [12]:
pisa.duplicated().sum()
Out[12]:
0
In [13]:
pisa.shape
Out[13]:
(24168, 19)

What is the structure of your dataset?

There are 485,490 students covered in the dataset with 635 features. 68 countries are represented

What is/are the main feature(s) of interest in your dataset?

  • The main feature that we will be investigate is the 'Average_Total_Score'

What features in the dataset do you think will help support your investigation into your feature(s) of interest?

  • To all the more likely comprehen the Average Total Score
  • The average assumption is that the more homework a student completes I anticipate that the instructive level of the guardians, and the measure of books that they have in their home will be a superior component to foresee the understudy's test related achievement.

Univariate Exploration

I'll start by looking at the distribution of the main variable of interest:

In [14]:
# Histogram of Average Total Score
plt.figure(figsize=[8, 5])
binSize = 20
bins = np.arange(0, pisa['Average_Total_Score'].max()+binSize, binSize)
plt.hist(data = pisa, x = 'Average_Total_Score', bins = bins, color = 'darkblue', alpha=0.5)
plt.xlabel('Average Total Score')
plt.ylabel('Frequency')
plt.title('Frequency of Average Total Scores');

Here we can see that it is a extremely ordinary appropriation This is generally not surprising since bell curves are expected when it comes to the grades of students.

We can now move onto the three scores that the total score is comprised of: Math, Reading, and Science.

In [15]:
# Histogram of Average Math Score
plt.figure(figsize=[8, 5])
binSize = 20
bins = np.arange(0, pisa['Average_Math_Score'].max()+binSize, binSize)
plt.hist(data = pisa, x = 'Average_Math_Score', bins = bins, color = 'darkblue', alpha=0.5)
plt.xlabel('Average Math Score')
plt.ylabel('Frequency')
plt.title('Frequency of Average Math Scores');
In [16]:
# Histogram of Average Science Score
plt.figure(figsize=[8, 5])
binSize = 20
bins = np.arange(0, pisa['Average_Science_Score'].max()+binSize, binSize)
plt.hist(data = pisa, x = 'Average_Science_Score', bins = bins, color = 'darkblue', alpha=0.5)
plt.xlabel('Average Science Score')
plt.ylabel('Frequency')
plt.title('Frequency of Average Science Scores');
In [17]:
# Histogram of Average Reading Score
plt.figure(figsize=[8, 5])
binSize = 20
bins = np.arange(0, pisa['Average_Reading_Score'].max()+binSize, binSize)
plt.hist(data = pisa, x = 'Average_Reading_Score', bins = bins, color = 'darkblue', alpha=0.5)
plt.xlabel('Average Reading Score')
plt.ylabel('Frequency')
plt.title('Frequency of Average Reading Scores');

We can undoubtedly say all of this distributions is very much so like the total score in that it has a distinct normal distribution

Now we can shift onto study time vars.

In [18]:
# Histogram of the Total Out-of-School Study Time
plt.figure(figsize=[8, 5])
binsize = 2 # set 2 here more reliable and displayed
bins = np.arange(0, pisa['Out-of-School Study Time - Total'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - Total', color = 'purple', bins = bins)

plt.xlabel('Out-of-School Study Time - Total (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Total Out-of-School Study Times');

we can see a strong right skew on this unimodal distribution. Due to the tail that extends past the peak,therfore 2 bins not enough to display the differ in sacles we should look at this variable on a smaller scale.

In [19]:
# Histogram of the Total Out-of-School Study Time
plt.figure(figsize=[8, 5])
binsize = 1 # smallest bin.
bins = np.arange(0, pisa['Out-of-School Study Time - Total'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - Total', color = 'purple', bins = bins)

plt.xlim(0,20)
plt.xlabel('Out-of-School Study Time - Total (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Total Out-of-School Study Times');

Now we can take a look closer in each variable ['Out-of-School Study Time - Homework', 'Out-of-School Study Time - Guided Homework', 'Out-of-School Study Time - Personal Tutor', 'Out-of-School Study Time - Commercial Company', 'Out-of-School Study Time - With Parent']

In [20]:
# Histogram of the Out-of-School Study Time for Homework
binsize = 1 # Smallest and reliable bin size
plt.figure(figsize=[8, 5])
bins = np.arange(0, pisa['Out-of-School Study Time - Homework'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - Homework', color = 'purple', bins = bins)

plt.xlabel('Out-of-School Study Time - Homework (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Out-of-School Study Times for Homework');
In [21]:
# Histogram of the Out-of-School Study Time for Guided Homework
binsize = 1 # Smallest and reliable bin size
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Out-of-School Study Time - Guided Homework'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - Guided Homework', color = 'purple', bins = bins)

plt.xlabel('Out-of-School Study Time - Guided Homework (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Out-of-School Study Times for Guided Homework');
In [22]:
# Histogram of the Out-of-School Study Time with a Personal Tutor
binsize = 1 # Smallest and reliable bin size
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Out-of-School Study Time - Personal Tutor'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - Personal Tutor', color = 'purple', bins = bins)

plt.xlim(0,15)
plt.xlabel('Out-of-School Study Time - Personal Tutor (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Out-of-School Study Times with a Personal Tutor');
In [23]:
# Histogram of the Out-of-School Study Time with a Commercial Company
binsize = 1 # Smallest and reliable bin size
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Out-of-School Study Time - Commercial Company'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - Commercial Company', color = 'purple', bins = bins)

plt.xlim(0,15)
plt.xlabel('Out-of-School Study Time - Commercial Company (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Out-of-School Study Times with a Commercial Company');
In [24]:
# Histogram of the Out-of-School Study Time with a Parent
binsize = 1
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Out-of-School Study Time - With Parent'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Out-of-School Study Time - With Parent', color = 'purple', bins = bins)

plt.xlim(0,20)
plt.xlabel('Out-of-School Study Time - With Parent (h/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Out-of-School Study Times with a Parent');

Every one of the above histograms for Out-of-School Study Time reflected precisely what we found in the Total Out-of-School Study Time histogram. They are altogether unequivocally left skewed unimodal distribution, which isn't a very remarkable amazement since understudies commonly put in some Investigation Time outside of school, yet the measure of time an understudy can commit to examining drops from there on.

Shift to learning time distributions

In [25]:
# Histogram of the Total Learning Time
binsize = 100
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Learning Time - Total'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Learning Time - Total', color = 'purple', bins=bins)
plt.xlim(0, 2500)
plt.xlabel('Learning Time - Total (mins/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Total Learning Times');

Although marginally skewed to the right, this distribution is significantly more typical on the off chance that we contrast with the Out-of-School Study Time distribution. In any case, to comprehend Learning Time,

we should investigate every one of the subjects.

In [26]:
# Histogram of the Science Learning Time
binsize = 25
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Learning Time - Science'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Learning Time - Science', color = 'purple', bins=bins)

plt.xlim(0, 700)
plt.xlabel('Learning Time - Science (mins/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Learning Times for Science');

On the other hand, shows a different story. For Science we can see a clear right skew.

In [27]:
# Histogram of the Mathematics Learning Time
binsize = 25
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Learning Time - Mathematics'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Learning Time - Mathematics', color = 'purple', bins=bins)

plt.xlim(0, 700)
plt.xlabel('Learning Time - Mathematics (mins/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Learning Times for Mathematics');

In general Mathematics Learning Time matches the unimodal and normal distribution that we saw for the Total Learning Time, although it is more sporadic in nature.

In [28]:
# Histogram of the Test Language Learning Time
binsize = 25
plt.figure(figsize=[8, 5])

bins = np.arange(0, pisa['Learning Time - Test Language'].max()+binsize, binsize)

plt.hist(data = pisa, x = 'Learning Time - Test Language', color = 'purple', bins=bins)

plt.xlim(0, 700)
plt.xlabel('Learning Time - Test Language (mins/week)')
plt.ylabel('Frequency')
plt.title('Frequency of Learning Times for the Test Language');

The same this dist. reflect the same dists. that we saw for both Mathematics and the Total Learning Time.

Since the entirety of the Learning Time variables have values that are beyond 600 minutes, and these values may mutilate our later plots, we ought to analyze them and decide whether it bodes well to dismiss them.

Select high outliers for the learning time total in each subject

In [29]:
high_outliers_math = (pisa['Learning Time - Mathematics'] > 600)

print(high_outliers_math.sum())
print(pisa.loc[high_outliers_math,:])
107
                        Country  Student ID  Gender  \
206                  Kazakhstan        4894    Male   
656         Massachusetts (USA)        1658    Male   
780    United States of America        1649    Male   
792    United States of America        2195    Male   
812    United States of America        4238    Male   
1139                     Brazil       11526    Male   
1331                     Canada        8086  Female   
1587       United Arab Emirates        8673    Male   
1627                    Denmark        1626    Male   
1986                     Canada       14395  Female   
2021                     Canada       17113    Male   
2024                     Canada       14277  Female   
2066                      Chile        3285  Female   
2221       United Arab Emirates        9562  Female   
2641                     Canada       17402  Female   
2646                     Canada       21437    Male   
2713                     Brazil       16899  Female   
3343             United Kingdom        6546    Male   
3380   United States of America        4338    Male   
3742                     Canada        7780  Female   
3745                     Canada        7385    Male   
3846       United Arab Emirates        7285    Male   
3942       United Arab Emirates        7834  Female   
3961       United Arab Emirates       10635    Male   
4076                      Chile        6723    Male   
4227                     Canada       19278    Male   
4257                     Canada       13393  Female   
4308                Switzerland       11010    Male   
4329                      Chile        5841  Female   
4412                      Chile         170    Male   
...                         ...         ...     ...   
17258                    Canada        6727    Male   
17296                     Chile        5137    Male   
17298                     Chile        1175  Female   
17303                     Chile         246  Female   
17310                     Chile         588    Male   
17324                     Chile        6716    Male   
17426                     Chile        3740  Female   
17427                     Chile        3463  Female   
18021                    Canada       10153    Male   
18591                    Canada       10416    Male   
18907                     Chile        6240    Male   
19061            United Kingdom       11879  Female   
19298                    Canada       18263    Male   
19366                 Australia        8626    Male   
19394                    Canada       10165    Male   
20583                     Chile        6324    Male   
20912      United Arab Emirates        8678    Male   
21240                     Spain       23856  Female   
21393                    Canada       14076    Male   
21973      United Arab Emirates        8204  Female   
22377                     Chile         505    Male   
22734                  Portugal         159  Female   
23165                  Portugal        3509    Male   
23276                      Peru        2819    Male   
23401                     Spain       12575    Male   
23781                    Canada       18264    Male   
24017               Switzerland       10665  Female   
24028                     Spain       21983    Male   
24062      United Arab Emirates        8650    Male   
24087      United Arab Emirates        6165  Female   

       Out-of-School Study Time - Homework  \
206                                    7.0   
656                                    6.0   
780                                    0.0   
792                                   10.0   
812                                    2.0   
1139                                   5.0   
1331                                   2.0   
1587                                  10.0   
1627                                   1.0   
1986                                   1.0   
2021                                   3.0   
2024                                   4.0   
2066                                   8.0   
2221                                   5.0   
2641                                   4.0   
2646                                   4.0   
2713                                   2.0   
3343                                   1.0   
3380                                   0.0   
3742                                   2.0   
3745                                  14.0   
3846                                   3.0   
3942                                  10.0   
3961                                   4.0   
4076                                   4.0   
4227                                   3.0   
4257                                   1.0   
4308                                   1.0   
4329                                   1.0   
4412                                   5.0   
...                                    ...   
17258                                  4.0   
17296                                  2.0   
17298                                  3.0   
17303                                  1.0   
17310                                  4.0   
17324                                  1.0   
17426                                  5.0   
17427                                  6.0   
18021                                  7.0   
18591                                  1.0   
18907                                  2.0   
19061                                  6.0   
19298                                  1.0   
19366                                  8.0   
19394                                  2.0   
20583                                  2.0   
20912                                  6.0   
21240                                  5.0   
21393                                 10.0   
21973                                 28.0   
22377                                  3.0   
22734                                  2.0   
23165                                  1.0   
23276                                  3.0   
23401                                  2.0   
23781                                  1.0   
24017                                  0.0   
24028                                  2.0   
24062                                 14.0   
24087                                  5.0   

       Out-of-School Study Time - Guided Homework  \
206                                           7.0   
656                                           0.0   
780                                           0.0   
792                                           5.0   
812                                           0.0   
1139                                          0.0   
1331                                          0.0   
1587                                         10.0   
1627                                          1.0   
1986                                          1.0   
2021                                          1.0   
2024                                          0.0   
2066                                          1.0   
2221                                          2.0   
2641                                          2.0   
2646                                          1.0   
2713                                          1.0   
3343                                          1.0   
3380                                          0.0   
3742                                          1.0   
3745                                          4.0   
3846                                          2.0   
3942                                          1.0   
3961                                          2.0   
4076                                          1.0   
4227                                          0.0   
4257                                          0.0   
4308                                          0.0   
4329                                          1.0   
4412                                          3.0   
...                                           ...   
17258                                         2.0   
17296                                         1.0   
17298                                         3.0   
17303                                         0.0   
17310                                         2.0   
17324                                         0.0   
17426                                         2.0   
17427                                         2.0   
18021                                         0.0   
18591                                         0.0   
18907                                         1.0   
19061                                         1.0   
19298                                         0.0   
19366                                         0.0   
19394                                         2.0   
20583                                         2.0   
20912                                         3.0   
21240                                         5.0   
21393                                         5.0   
21973                                        17.0   
22377                                         1.0   
22734                                         1.0   
23165                                         0.0   
23276                                         3.0   
23401                                         1.0   
23781                                         0.0   
24017                                         0.0   
24028                                         0.0   
24062                                        14.0   
24087                                         1.0   

       Out-of-School Study Time - Personal Tutor  \
206                                          0.0   
656                                          0.0   
780                                          0.0   
792                                          0.0   
812                                          0.0   
1139                                         0.0   
1331                                         0.0   
1587                                        10.0   
1627                                         1.0   
1986                                         0.0   
2021                                         0.0   
2024                                         0.0   
2066                                         1.0   
2221                                         0.0   
2641                                         1.0   
2646                                         0.0   
2713                                         1.0   
3343                                         0.0   
3380                                         0.0   
3742                                         0.0   
3745                                         1.0   
3846                                         1.0   
3942                                         0.0   
3961                                         6.0   
4076                                         0.0   
4227                                         0.0   
4257                                         0.0   
4308                                         0.0   
4329                                         0.0   
4412                                         0.0   
...                                          ...   
17258                                        0.0   
17296                                        0.0   
17298                                        0.0   
17303                                        0.0   
17310                                        0.0   
17324                                        0.0   
17426                                        0.0   
17427                                        0.0   
18021                                        0.0   
18591                                        0.0   
18907                                        0.0   
19061                                        0.0   
19298                                        0.0   
19366                                        0.0   
19394                                        0.0   
20583                                        2.0   
20912                                        1.0   
21240                                        5.0   
21393                                        0.0   
21973                                        0.0   
22377                                        0.0   
22734                                        4.0   
23165                                        0.0   
23276                                        0.0   
23401                                        0.0   
23781                                        0.0   
24017                                        0.0   
24028                                        0.0   
24062                                       14.0   
24087                                        0.0   

       Out-of-School Study Time - Commercial Company  \
206                                              0.0   
656                                              0.0   
780                                              1.0   
792                                              0.0   
812                                              0.0   
1139                                             0.0   
1331                                             0.0   
1587                                            10.0   
1627                                             1.0   
1986                                             0.0   
2021                                             0.0   
2024                                             0.0   
2066                                             0.0   
2221                                             0.0   
2641                                             0.0   
2646                                             0.0   
2713                                             0.0   
3343                                             0.0   
3380                                             0.0   
3742                                             0.0   
3745                                             0.0   
3846                                             0.0   
3942                                             0.0   
3961                                             0.0   
4076                                             0.0   
4227                                             0.0   
4257                                             0.0   
4308                                             0.0   
4329                                             0.0   
4412                                             0.0   
...                                              ...   
17258                                            3.0   
17296                                            0.0   
17298                                            0.0   
17303                                            0.0   
17310                                            0.0   
17324                                            0.0   
17426                                            0.0   
17427                                            2.0   
18021                                            0.0   
18591                                            0.0   
18907                                            0.0   
19061                                            0.0   
19298                                            0.0   
19366                                            0.0   
19394                                            0.0   
20583                                            0.0   
20912                                            4.0   
21240                                            0.0   
21393                                            0.0   
21973                                            0.0   
22377                                            0.0   
22734                                            0.0   
23165                                            0.0   
23276                                            0.0   
23401                                            0.0   
23781                                            0.0   
24017                                            0.0   
24028                                            0.0   
24062                                           15.0   
24087                                            0.0   

       Out-of-School Study Time - With Parent  Learning Time - Mathematics  \
206                                       0.0                        810.0   
656                                       1.0                        720.0   
780                                       0.0                        650.0   
792                                       5.0                        650.0   
812                                       0.0                       1200.0   
1139                                      0.0                        720.0   
1331                                      3.0                        675.0   
1587                                      3.0                        630.0   
1627                                      1.0                        960.0   
1986                                      1.0                        750.0   
2021                                      3.0                        650.0   
2024                                      0.0                        720.0   
2066                                      1.0                        630.0   
2221                                      2.0                        810.0   
2641                                      5.0                        675.0   
2646                                      1.0                        630.0   
2713                                      0.0                        650.0   
3343                                      1.0                        720.0   
3380                                      0.0                        750.0   
3742                                      0.0                        658.0   
3745                                      1.0                        960.0   
3846                                      0.0                        630.0   
3942                                      1.0                        720.0   
3961                                      3.0                        640.0   
4076                                      2.0                        840.0   
4227                                      0.0                        630.0   
4257                                      0.0                        805.0   
4308                                      0.0                        720.0   
4329                                      0.0                        720.0   
4412                                      2.0                        630.0   
...                                       ...                          ...   
17258                                     1.0                        800.0   
17296                                     3.0                        630.0   
17298                                     0.0                        720.0   
17303                                     0.0                        900.0   
17310                                     2.0                        630.0   
17324                                     0.0                        630.0   
17426                                     0.0                        720.0   
17427                                     2.0                        720.0   
18021                                     0.0                        800.0   
18591                                     0.0                       1200.0   
18907                                     0.0                        720.0   
19061                                     0.0                        875.0   
19298                                     0.0                        700.0   
19366                                     0.0                        630.0   
19394                                     0.0                        800.0   
20583                                     1.0                       1200.0   
20912                                     5.0                        630.0   
21240                                     0.0                        960.0   
21393                                     5.0                        700.0   
21973                                     7.0                       1260.0   
22377                                     0.0                        840.0   
22734                                     2.0                        675.0   
23165                                     0.0                        720.0   
23276                                     1.0                        720.0   
23401                                     0.0                        720.0   
23781                                     0.0                        650.0   
24017                                     0.0                        675.0   
24028                                     0.0                        720.0   
24062                                    15.0                        630.0   
24087                                     1.0                        720.0   

       Learning Time - Test Language  Learning Time - Science  \
206                             45.0                   1350.0   
656                            720.0                    640.0   
780                            650.0                    390.0   
792                            650.0                    650.0   
812                            300.0                    300.0   
1139                           720.0                    420.0   
1331                           375.0                    450.0   
1587                           630.0                    630.0   
1627                           960.0                    240.0   
1986                           750.0                    750.0   
2021                           300.0                    300.0   
2024                           180.0                    720.0   
2066                           630.0                    630.0   
2221                           540.0                    270.0   
2641                           480.0                    427.0   
2646                           630.0                    630.0   
2713                           300.0                    400.0   
3343                           720.0                    480.0   
3380                           375.0                    375.0   
3742                           658.0                    658.0   
3745                           240.0                    960.0   
3846                           720.0                    495.0   
3942                           240.0                    880.0   
3961                           160.0                   1200.0   
4076                           840.0                    480.0   
4227                           630.0                    630.0   
4257                           805.0                    805.0   
4308                           360.0                    360.0   
4329                           720.0                    240.0   
4412                           720.0                    180.0   
...                              ...                      ...   
17258                          200.0                    400.0   
17296                          540.0                    810.0   
17298                          720.0                    540.0   
17303                          900.0                    900.0   
17310                          540.0                    180.0   
17324                          720.0                    270.0   
17426                          720.0                    360.0   
17427                          720.0                    270.0   
18021                          800.0                    800.0   
18591                          300.0                    300.0   
18907                          540.0                    180.0   
19061                          875.0                    875.0   
19298                          700.0                    700.0   
19366                          210.0                    630.0   
19394                          800.0                    800.0   
20583                          960.0                    480.0   
20912                          540.0                    675.0   
21240                          960.0                    960.0   
21393                          350.0                    350.0   
21973                          495.0                    495.0   
22377                          840.0                    960.0   
22734                          675.0                    180.0   
23165                          720.0                    420.0   
23276                          240.0                    480.0   
23401                          240.0                    180.0   
23781                          800.0                    750.0   
24017                          810.0                     90.0   
24028                          720.0                    840.0   
24062                          630.0                    630.0   
24087                          280.0                    720.0   

       Average_Math_Score  Average_Reading_Score  Average_Science_Score  \
206             519.71490              427.25806              482.97276   
656             472.74498              446.74536              548.99290   
780             470.87552              446.42458              483.34574   
792             455.21890              457.73198              526.98618   
812             561.93336              548.83294              554.02834   
1139            568.71008              553.80500              602.23798   
1331            478.66492              526.55212              499.01158   
1587            367.04312              258.04766              366.59828   
1627            446.57268              340.24700              296.28870   
1986            486.29850              465.54912              497.33308   
2021            637.87972              615.71518              620.51472   
2024            508.96558              499.46614              429.54122   
2066            483.18274              566.02932              465.34874   
2221            492.06264              529.96766              538.45580   
2641            348.03708              310.73806              269.33978   
2646            417.20672              456.84986              479.24280   
2713            404.74372              422.73580              453.03990   
3343            363.92742              331.34544              387.48600   
3380            632.34930              644.66542              627.78814   
3742            645.43542              712.18238              687.46738   
3745            630.16826              649.71764              599.90676   
3846            407.78160              409.61528              447.81796   
3942            601.58124              654.59494              620.04850   
3961            453.81680              491.25330              496.02758   
4076            439.40644              451.63720              517.00858   
4227            564.65962              618.44178              650.54084   
4257            474.69230              546.80702              477.56436   
4308            716.94190              604.80874              695.02050   
4329            353.25596              475.79570              404.92352   
4412            456.07570              497.58866              526.70648   
...                   ...                    ...                    ...   
17258           489.72582              519.08078              554.58786   
17296           436.52438              421.00288              378.16116   
17298           488.55740              558.88054              531.46214   
17303           334.95092              426.38962              359.88438   
17310           511.76974              494.46108              565.40470   
17324           499.61834              484.51696              525.86722   
17426           378.33772              473.73052              455.83740   
17427           454.51782              519.16502              533.04738   
18021           594.25920              619.88530              619.02276   
18591           403.80900              360.13526              430.28720   
18907           434.49914              440.57036              436.90788   
19061           574.39634              588.11116              576.59456   
19298           462.22932              470.56310              474.02090   
19366           665.45412              607.29476              653.05858   
19394           426.32030              470.96410              491.36514   
20583           360.65588              374.00892              442.68932   
20912           414.48044              413.78540              419.28386   
21240           371.71680              354.02796              372.00670   
21393           379.50618              374.24952              344.31182   
21973           357.85170              411.93318              329.48528   
22377           542.61564              490.93250              520.17904   
22734           408.63844              476.90772              460.59306   
23165           421.88036              434.79636              435.97540   
23276           327.47314              234.47046              307.10554   
23401           387.60710              358.45118              415.27412   
23781           355.51488              348.10612              328.55278   
24017           419.93300              384.68830              352.42444   
24028           376.23462              383.87286              485.95676   
24062           244.59418              259.33080              295.54270   
24087           492.60786              531.39742              478.31034   

       Average_Total_Score        Education - Father  \
206             476.648573  Bachelor’s or equivalent   
656             489.494413  Bachelor’s or equivalent   
780             466.881947  Bachelor’s or equivalent   
792             479.979020  Bachelor’s or equivalent   
812             554.931547  Bachelor’s or equivalent   
1139            574.917687  Bachelor’s or equivalent   
1331            501.409540  Bachelor’s or equivalent   
1587            330.563020  Bachelor’s or equivalent   
1627            361.036127  Bachelor’s or equivalent   
1986            483.060233  Bachelor’s or equivalent   
2021            624.703207  Bachelor’s or equivalent   
2024            479.324313  Bachelor’s or equivalent   
2066            504.853600  Bachelor’s or equivalent   
2221            520.162033      Short-cycle tertiary   
2641            309.371640           Upper secondary   
2646            451.099793           Upper secondary   
2713            426.839807                   Primary   
3343            360.919620  Bachelor’s or equivalent   
3380            634.934287  Bachelor’s or equivalent   
3742            681.695060  Bachelor’s or equivalent   
3745            626.597553  Bachelor’s or equivalent   
3846            421.738280  Bachelor’s or equivalent   
3942            625.408227  Bachelor’s or equivalent   
3961            480.365893  Bachelor’s or equivalent   
4076            469.350740  Bachelor’s or equivalent   
4227            611.214080  Bachelor’s or equivalent   
4257            499.687893  Bachelor’s or equivalent   
4308            672.257047  Bachelor’s or equivalent   
4329            411.325060  Bachelor’s or equivalent   
4412            493.456947      Short-cycle tertiary   
...                    ...                       ...   
17258           521.131487      Short-cycle tertiary   
17296           411.896140      Short-cycle tertiary   
17298           526.300027      Short-cycle tertiary   
17303           373.741640      Short-cycle tertiary   
17310           523.878507      Short-cycle tertiary   
17324           503.334173      Short-cycle tertiary   
17426           435.968547      Short-cycle tertiary   
17427           502.243407      Short-cycle tertiary   
18021           611.055753      Short-cycle tertiary   
18591           398.077153            Post-secondary   
18907           437.325793           Upper secondary   
19061           579.700687      Short-cycle tertiary   
19298           468.937773           Upper secondary   
19366           641.935820           Upper secondary   
19394           462.883180           Upper secondary   
20583           392.451373           Upper secondary   
20912           415.849900           Lower secondary   
21240           365.917153                   Primary   
21393           366.022507           Upper secondary   
21973           366.423387           Upper secondary   
22377           517.909060      Short-cycle tertiary   
22734           448.713073      Short-cycle tertiary   
23165           430.884040  Bachelor’s or equivalent   
23276           289.683047  Bachelor’s or equivalent   
23401           387.110800      Short-cycle tertiary   
23781           344.057927            Post-secondary   
24017           385.681913      Short-cycle tertiary   
24028           415.354747      Short-cycle tertiary   
24062           266.489227            Post-secondary   
24087           500.771873           Upper secondary   

             Education - Mother  Out-of-School Study Time - Total  \
206    Bachelor’s or equivalent                              14.0   
656    Bachelor’s or equivalent                               7.0   
780    Bachelor’s or equivalent                               1.0   
792    Bachelor’s or equivalent                              20.0   
812    Bachelor’s or equivalent                               2.0   
1139   Bachelor’s or equivalent                               5.0   
1331   Bachelor’s or equivalent                               5.0   
1587   Bachelor’s or equivalent                              43.0   
1627   Bachelor’s or equivalent                               5.0   
1986   Bachelor’s or equivalent                               3.0   
2021   Bachelor’s or equivalent                               7.0   
2024   Bachelor’s or equivalent                               4.0   
2066   Bachelor’s or equivalent                              11.0   
2221   Bachelor’s or equivalent                               9.0   
2641   Bachelor’s or equivalent                              12.0   
2646   Bachelor’s or equivalent                               6.0   
2713   Bachelor’s or equivalent                               4.0   
3343       Short-cycle tertiary                               3.0   
3380       Short-cycle tertiary                               0.0   
3742       Short-cycle tertiary                               3.0   
3745       Short-cycle tertiary                              20.0   
3846       Short-cycle tertiary                               6.0   
3942       Short-cycle tertiary                              12.0   
3961       Short-cycle tertiary                              15.0   
4076       Short-cycle tertiary                               7.0   
4227       Short-cycle tertiary                               3.0   
4257       Short-cycle tertiary                               1.0   
4308       Short-cycle tertiary                               1.0   
4329       Short-cycle tertiary                               2.0   
4412       Short-cycle tertiary                              10.0   
...                         ...                               ...   
17258           Upper secondary                              10.0   
17296           Upper secondary                               6.0   
17298           Upper secondary                               6.0   
17303           Upper secondary                               1.0   
17310           Upper secondary                               8.0   
17324           Upper secondary                               1.0   
17426           Upper secondary                               7.0   
17427           Upper secondary                              12.0   
18021           Upper secondary                               7.0   
18591           Upper secondary                               1.0   
18907           Upper secondary                               3.0   
19061           Upper secondary                               7.0   
19298           Upper secondary                               1.0   
19366           Upper secondary                               8.0   
19394           Upper secondary                               4.0   
20583           Lower secondary                               7.0   
20912           Lower secondary                              19.0   
21240           Lower secondary                              15.0   
21393           Lower secondary                              20.0   
21973           Lower secondary                              52.0   
22377           Lower secondary                               4.0   
22734           Lower secondary                               9.0   
23165           Lower secondary                               1.0   
23276           Lower secondary                               7.0   
23401           Lower secondary                               3.0   
23781                   Primary                               1.0   
24017           Early childhood                               0.0   
24028           Early childhood                               2.0   
24062           Early childhood                              72.0   
24087           Early childhood                               7.0   

       Learning Time - Total  
206                   2205.0  
656                   2080.0  
780                   1690.0  
792                   1950.0  
812                   1800.0  
1139                  1860.0  
1331                  1500.0  
1587                  1890.0  
1627                  2160.0  
1986                  2250.0  
2021                  1250.0  
2024                  1620.0  
2066                  1890.0  
2221                  1620.0  
2641                  1582.0  
2646                  1890.0  
2713                  1350.0  
3343                  1920.0  
3380                  1500.0  
3742                  1974.0  
3745                  2160.0  
3846                  1845.0  
3942                  1840.0  
3961                  2000.0  
4076                  2160.0  
4227                  1890.0  
4257                  2415.0  
4308                  1440.0  
4329                  1680.0  
4412                  1530.0  
...                      ...  
17258                 1400.0  
17296                 1980.0  
17298                 1980.0  
17303                 2700.0  
17310                 1350.0  
17324                 1620.0  
17426                 1800.0  
17427                 1710.0  
18021                 2400.0  
18591                 1800.0  
18907                 1440.0  
19061                 2625.0  
19298                 2100.0  
19366                 1470.0  
19394                 2400.0  
20583                 2640.0  
20912                 1845.0  
21240                 2880.0  
21393                 1400.0  
21973                 2250.0  
22377                 2640.0  
22734                 1530.0  
23165                 1860.0  
23276                 1440.0  
23401                 1140.0  
23781                 2200.0  
24017                 1575.0  
24028                 2280.0  
24062                 1890.0  
24087                 1720.0  

[107 rows x 19 columns]
In [30]:
high_outliers_lang = (pisa['Learning Time - Test Language'] > 600)

print(high_outliers_lang.sum())
print(pisa.loc[high_outliers_lang,:])
105
                        Country  Student ID  Gender  \
409              United Kingdom       10803  Female   
656         Massachusetts (USA)        1658    Male   
780    United States of America        1649    Male   
792    United States of America        2195    Male   
1120                     Brazil        4153    Male   
1139                     Brazil       11526    Male   
1468       United Arab Emirates        7004  Female   
1587       United Arab Emirates        8673    Male   
1605       United Arab Emirates       10226    Male   
1627                    Denmark        1626    Male   
1986                     Canada       14395  Female   
2066                      Chile        3285  Female   
2244                    Denmark        7234  Female   
2291                     Canada        5482  Female   
2646                     Canada       21437    Male   
3304              Florida (USA)         739  Female   
3343             United Kingdom        6546    Male   
3742                     Canada        7780  Female   
3769                     Canada        8745    Male   
3846       United Arab Emirates        7285    Male   
4022                    Denmark         784    Male   
4076                      Chile        6723    Male   
4227                     Canada       19278    Male   
4257                     Canada       13393  Female   
4329                      Chile        5841  Female   
4339                      Chile        3070  Female   
4412                      Chile         170    Male   
4502                      Chile        6694  Female   
4512                      Chile        3263    Male   
4627                     Canada       21295    Male   
...                         ...         ...     ...   
16895                    Canada       21099    Male   
17294                     Chile        5793  Female   
17298                     Chile        1175  Female   
17302                     Chile        6000    Male   
17303                     Chile         246  Female   
17324                     Chile        6716    Male   
17426                     Chile        3740  Female   
17427                     Chile        3463  Female   
17634  United States of America         354  Female   
17701                   Denmark        3173    Male   
18021                    Canada       10153    Male   
18139                    Canada       10176    Male   
19061            United Kingdom       11879  Female   
19298                    Canada       18263    Male   
19394                    Canada       10165    Male   
20583                     Chile        6324    Male   
21240                     Spain       23856  Female   
21505                   Denmark        7023    Male   
22263                    Canada       16655    Male   
22377                     Chile         505    Male   
22734                  Portugal         159  Female   
23165                  Portugal        3509    Male   
23302                   Denmark        1527    Male   
23502                     Spain       18803  Female   
23781                    Canada       18264    Male   
24017               Switzerland       10665  Female   
24028                     Spain       21983    Male   
24056                    Brazil       15168  Female   
24062      United Arab Emirates        8650    Male   
24167                     Chile        6301  Female   

       Out-of-School Study Time - Homework  \
409                                   12.0   
656                                    6.0   
780                                    0.0   
792                                   10.0   
1120                                   3.0   
1139                                   5.0   
1468                                   4.0   
1587                                  10.0   
1605                                   5.0   
1627                                   1.0   
1986                                   1.0   
2066                                   8.0   
2244                                   2.0   
2291                                   8.0   
2646                                   4.0   
3304                                   3.0   
3343                                   1.0   
3742                                   2.0   
3769                                   5.0   
3846                                   3.0   
4022                                   4.0   
4076                                   4.0   
4227                                   3.0   
4257                                   1.0   
4329                                   1.0   
4339                                   7.0   
4412                                   5.0   
4502                                   3.0   
4512                                   7.0   
4627                                   2.0   
...                                    ...   
16895                                  1.0   
17294                                  3.0   
17298                                  3.0   
17302                                  4.0   
17303                                  1.0   
17324                                  1.0   
17426                                  5.0   
17427                                  6.0   
17634                                  0.0   
17701                                  4.0   
18021                                  7.0   
18139                                  6.0   
19061                                  6.0   
19298                                  1.0   
19394                                  2.0   
20583                                  2.0   
21240                                  5.0   
21505                                  5.0   
22263                                  4.0   
22377                                  3.0   
22734                                  2.0   
23165                                  1.0   
23302                                  1.0   
23502                                  5.0   
23781                                  1.0   
24017                                  0.0   
24028                                  2.0   
24056                                 10.0   
24062                                 14.0   
24167                                  0.0   

       Out-of-School Study Time - Guided Homework  \
409                                          10.0   
656                                           0.0   
780                                           0.0   
792                                           5.0   
1120                                          3.0   
1139                                          0.0   
1468                                          1.0   
1587                                         10.0   
1605                                          1.0   
1627                                          1.0   
1986                                          1.0   
2066                                          1.0   
2244                                          0.0   
2291                                          4.0   
2646                                          1.0   
3304                                          0.0   
3343                                          1.0   
3742                                          1.0   
3769                                          2.0   
3846                                          2.0   
4022                                          0.0   
4076                                          1.0   
4227                                          0.0   
4257                                          0.0   
4329                                          1.0   
4339                                          1.0   
4412                                          3.0   
4502                                          0.0   
4512                                          2.0   
4627                                          2.0   
...                                           ...   
16895                                         0.0   
17294                                         0.0   
17298                                         3.0   
17302                                         1.0   
17303                                         0.0   
17324                                         0.0   
17426                                         2.0   
17427                                         2.0   
17634                                         0.0   
17701                                         1.0   
18021                                         0.0   
18139                                         0.0   
19061                                         1.0   
19298                                         0.0   
19394                                         2.0   
20583                                         2.0   
21240                                         5.0   
21505                                         1.0   
22263                                         0.0   
22377                                         1.0   
22734                                         1.0   
23165                                         0.0   
23302                                         1.0   
23502                                         0.0   
23781                                         0.0   
24017                                         0.0   
24028                                         0.0   
24056                                         5.0   
24062                                        14.0   
24167                                         0.0   

       Out-of-School Study Time - Personal Tutor  \
409                                         14.0   
656                                          0.0   
780                                          0.0   
792                                          0.0   
1120                                         4.0   
1139                                         0.0   
1468                                         0.0   
1587                                        10.0   
1605                                         0.0   
1627                                         1.0   
1986                                         0.0   
2066                                         1.0   
2244                                         0.0   
2291                                         0.0   
2646                                         0.0   
3304                                         0.0   
3343                                         0.0   
3742                                         0.0   
3769                                         0.0   
3846                                         1.0   
4022                                         0.0   
4076                                         0.0   
4227                                         0.0   
4257                                         0.0   
4329                                         0.0   
4339                                         0.0   
4412                                         0.0   
4502                                         1.0   
4512                                         0.0   
4627                                         0.0   
...                                          ...   
16895                                        0.0   
17294                                        0.0   
17298                                        0.0   
17302                                        1.0   
17303                                        0.0   
17324                                        0.0   
17426                                        0.0   
17427                                        0.0   
17634                                        0.0   
17701                                        0.0   
18021                                        0.0   
18139                                        0.0   
19061                                        0.0   
19298                                        0.0   
19394                                        0.0   
20583                                        2.0   
21240                                        5.0   
21505                                        0.0   
22263                                        0.0   
22377                                        0.0   
22734                                        4.0   
23165                                        0.0   
23302                                        1.0   
23502                                        0.0   
23781                                        0.0   
24017                                        0.0   
24028                                        0.0   
24056                                        0.0   
24062                                       14.0   
24167                                        0.0   

       Out-of-School Study Time - Commercial Company  \
409                                              2.0   
656                                              0.0   
780                                              1.0   
792                                              0.0   
1120                                             3.0   
1139                                             0.0   
1468                                             0.0   
1587                                            10.0   
1605                                             0.0   
1627                                             1.0   
1986                                             0.0   
2066                                             0.0   
2244                                             0.0   
2291                                             0.0   
2646                                             0.0   
3304                                             0.0   
3343                                             0.0   
3742                                             0.0   
3769                                             1.0   
3846                                             0.0   
4022                                             0.0   
4076                                             0.0   
4227                                             0.0   
4257                                             0.0   
4329                                             0.0   
4339                                             0.0   
4412                                             0.0   
4502                                             0.0   
4512                                             0.0   
4627                                             0.0   
...                                              ...   
16895                                            0.0   
17294                                            0.0   
17298                                            0.0   
17302                                            0.0   
17303                                            0.0   
17324                                            0.0   
17426                                            0.0   
17427                                            2.0   
17634                                            0.0   
17701                                            0.0   
18021                                            0.0   
18139                                            0.0   
19061                                            0.0   
19298                                            0.0   
19394                                            0.0   
20583                                            0.0   
21240                                            0.0   
21505                                            2.0   
22263                                            0.0   
22377                                            0.0   
22734                                            0.0   
23165                                            0.0   
23302                                            1.0   
23502                                            0.0   
23781                                            0.0   
24017                                            0.0   
24028                                            0.0   
24056                                            0.0   
24062                                           15.0   
24167                                            0.0   

       Out-of-School Study Time - With Parent  Learning Time - Mathematics  \
409                                      10.0                        360.0   
656                                       1.0                        720.0   
780                                       0.0                        650.0   
792                                       5.0                        650.0   
1120                                      1.0                        240.0   
1139                                      0.0                        720.0   
1468                                      0.0                        540.0   
1587                                      3.0                        630.0   
1605                                      1.0                        540.0   
1627                                      1.0                        960.0   
1986                                      1.0                        750.0   
2066                                      1.0                        630.0   
2244                                      0.0                        180.0   
2291                                      4.0                        540.0   
2646                                      1.0                        630.0   
3304                                      0.0                        250.0   
3343                                      1.0                        720.0   
3742                                      0.0                        658.0   
3769                                      1.0                        450.0   
3846                                      0.0                        630.0   
4022                                      1.0                        360.0   
4076                                      2.0                        840.0   
4227                                      0.0                        630.0   
4257                                      0.0                        805.0   
4329                                      0.0                        720.0   
4339                                      0.0                        540.0   
4412                                      2.0                        630.0   
4502                                      0.0                        720.0   
4512                                      0.0                        720.0   
4627                                      1.0                        602.0   
...                                       ...                          ...   
16895                                     0.0                        800.0   
17294                                     0.0                        540.0   
17298                                     0.0                        720.0   
17302                                     0.0                        540.0   
17303                                     0.0                        900.0   
17324                                     0.0                        630.0   
17426                                     0.0                        720.0   
17427                                     2.0                        720.0   
17634                                     0.0                         96.0   
17701                                     1.0                        450.0   
18021                                     0.0                        800.0   
18139                                     0.0                          0.0   
19061                                     0.0                        875.0   
19298                                     0.0                        700.0   
19394                                     0.0                        800.0   
20583                                     1.0                       1200.0   
21240                                     0.0                        960.0   
21505                                     5.0                        270.0   
22263                                     0.0                        375.0   
22377                                     0.0                        840.0   
22734                                     2.0                        675.0   
23165                                     0.0                        720.0   
23302                                     1.0                        540.0   
23502                                     0.0                        500.0   
23781                                     0.0                        650.0   
24017                                     0.0                        675.0   
24028                                     0.0                        720.0   
24056                                     5.0                        250.0   
24062                                    15.0                        630.0   
24167                                     1.0                        540.0   

       Learning Time - Test Language  Learning Time - Science  \
409                            720.0                    300.0   
656                            720.0                    640.0   
780                            650.0                    390.0   
792                            650.0                    650.0   
1120                          1440.0                    240.0   
1139                           720.0                    420.0   
1468                           720.0                    540.0   
1587                           630.0                    630.0   
1605                           810.0                   1080.0   
1627                           960.0                    240.0   
1986                           750.0                    750.0   
2066                           630.0                    630.0   
2244                           720.0                    720.0   
2291                           630.0                    540.0   
2646                           630.0                    630.0   
3304                          1000.0                    250.0   
3343                           720.0                    480.0   
3742                           658.0                    658.0   
3769                           675.0                    375.0   
3846                           720.0                    495.0   
4022                           720.0                    135.0   
4076                           840.0                    480.0   
4227                           630.0                    630.0   
4257                           805.0                    805.0   
4329                           720.0                    240.0   
4339                           720.0                    810.0   
4412                           720.0                    180.0   
4502                           720.0                    360.0   
4512                           720.0                    720.0   
4627                           602.0                    602.0   
...                              ...                      ...   
16895                          800.0                    800.0   
17294                          720.0                    540.0   
17298                          720.0                    540.0   
17302                          630.0                    810.0   
17303                          900.0                    900.0   
17324                          720.0                    270.0   
17426                          720.0                    360.0   
17427                          720.0                    270.0   
17634                         1056.0                     96.0   
17701                          810.0                    180.0   
18021                          800.0                    800.0   
18139                          800.0                    800.0   
19061                          875.0                    875.0   
19298                          700.0                    700.0   
19394                          800.0                    800.0   
20583                          960.0                    480.0   
21240                          960.0                    960.0   
21505                          630.0                    270.0   
22263                          750.0                      0.0   
22377                          840.0                    960.0   
22734                          675.0                    180.0   
23165                          720.0                    420.0   
23302                          630.0                    225.0   
23502                          700.0                    400.0   
23781                          800.0                    750.0   
24017                          810.0                     90.0   
24028                          720.0                    840.0   
24056                          750.0                    100.0   
24062                          630.0                    630.0   
24167                          720.0                     90.0   

       Average_Math_Score  Average_Reading_Score  Average_Science_Score  \
409             348.58234              338.61834              334.33420   
656             472.74498              446.74536              548.99290   
780             470.87552              446.42458              483.34574   
792             455.21890              457.73198              526.98618   
1120            433.79810              489.00786              454.43862   
1139            568.71008              553.80500              602.23798   
1468            517.53388              514.39918              491.55164   
1587            367.04312              258.04766              366.59828   
1605            665.76568              606.57300              707.23610   
1627            446.57268              340.24700              296.28870   
1986            486.29850              465.54912              497.33308   
2066            483.18274              566.02932              465.34874   
2244            478.27542              548.23678              490.43268   
2291            501.09832              545.37726              515.88960   
2646            417.20672              456.84986              479.24280   
3304            523.22014              549.50768              568.29542   
3343            363.92742              331.34544              387.48600   
3742            645.43542              712.18238              687.46738   
3769            483.18272              380.02350              424.78552   
3846            407.78160              409.61528              447.81796   
4022            658.21000              664.87442              683.55090   
4076            439.40644              451.63720              517.00858   
4227            564.65962              618.44178              650.54084   
4257            474.69230              546.80702              477.56436   
4329            353.25596              475.79570              404.92352   
4339            485.05218              552.36722              561.86124   
4412            456.07570              497.58866              526.70648   
4502            457.08834              533.14490              495.46808   
4512            502.42248              490.93252              497.51960   
4627            492.76368              493.89972              523.16302   
...                   ...                    ...                    ...   
16895           561.54388              562.38584              613.70758   
17294           488.40160              538.06960              540.78702   
17298           488.55740              558.88054              531.46214   
17302           552.35240              506.65064              503.20776   
17303           334.95092              426.38962              359.88438   
17324           499.61834              484.51696              525.86722   
17426           378.33772              473.73052              455.83740   
17427           454.51782              519.16502              533.04738   
17634           336.74248              394.45834              376.57590   
17701           575.01948              595.66654              589.64940   
18021           594.25920              619.88530              619.02276   
18139           526.80326              513.62758              551.04438   
19061           574.39634              588.11116              576.59456   
19298           462.22932              470.56310              474.02090   
19394           426.32030              470.96410              491.36514   
20583           360.65588              374.00892              442.68932   
21240           371.71680              354.02796              372.00670   
21505           620.27574              587.48672              594.77804   
22263           623.31360              655.17090              647.37038   
22377           542.61564              490.93250              520.17904   
22734           408.63844              476.90772              460.59306   
23165           421.88036              434.79636              435.97540   
23302           330.43310              288.04040              309.62330   
23502           466.82504              452.84014              427.20998   
23781           355.51488              348.10612              328.55278   
24017           419.93300              384.68830              352.42444   
24028           376.23462              383.87286              485.95676   
24056           371.87254              462.61016              410.05222   
24062           244.59418              259.33080              295.54270   
24167           301.69028              311.29408              287.52330   

       Average_Total_Score        Education - Father  \
409             340.511627  Bachelor’s or equivalent   
656             489.494413  Bachelor’s or equivalent   
780             466.881947  Bachelor’s or equivalent   
792             479.979020  Bachelor’s or equivalent   
1120            459.081527  Bachelor’s or equivalent   
1139            574.917687  Bachelor’s or equivalent   
1468            507.828233  Bachelor’s or equivalent   
1587            330.563020  Bachelor’s or equivalent   
1605            659.858260  Bachelor’s or equivalent   
1627            361.036127  Bachelor’s or equivalent   
1986            483.060233  Bachelor’s or equivalent   
2066            504.853600  Bachelor’s or equivalent   
2244            505.648293      Short-cycle tertiary   
2291            520.788393      Short-cycle tertiary   
2646            451.099793           Upper secondary   
3304            547.007747  Bachelor’s or equivalent   
3343            360.919620  Bachelor’s or equivalent   
3742            681.695060  Bachelor’s or equivalent   
3769            429.330580  Bachelor’s or equivalent   
3846            421.738280  Bachelor’s or equivalent   
4022            668.878440  Bachelor’s or equivalent   
4076            469.350740  Bachelor’s or equivalent   
4227            611.214080  Bachelor’s or equivalent   
4257            499.687893  Bachelor’s or equivalent   
4329            411.325060  Bachelor’s or equivalent   
4339            533.093547  Bachelor’s or equivalent   
4412            493.456947      Short-cycle tertiary   
4502            495.233773      Short-cycle tertiary   
4512            496.958200      Short-cycle tertiary   
4627            503.275473      Short-cycle tertiary   
...                    ...                       ...   
16895           579.212433           Lower secondary   
17294           522.419407      Short-cycle tertiary   
17298           526.300027      Short-cycle tertiary   
17302           520.736933      Short-cycle tertiary   
17303           373.741640      Short-cycle tertiary   
17324           503.334173      Short-cycle tertiary   
17426           435.968547      Short-cycle tertiary   
17427           502.243407      Short-cycle tertiary   
17634           369.258907      Short-cycle tertiary   
17701           586.778473      Short-cycle tertiary   
18021           611.055753      Short-cycle tertiary   
18139           530.491740      Short-cycle tertiary   
19061           579.700687      Short-cycle tertiary   
19298           468.937773           Upper secondary   
19394           462.883180           Upper secondary   
20583           392.451373           Upper secondary   
21240           365.917153                   Primary   
21505           600.846833           Upper secondary   
22263           641.951627  Bachelor’s or equivalent   
22377           517.909060      Short-cycle tertiary   
22734           448.713073      Short-cycle tertiary   
23165           430.884040  Bachelor’s or equivalent   
23302           309.365600      Short-cycle tertiary   
23502           448.958387                   Primary   
23781           344.057927            Post-secondary   
24017           385.681913      Short-cycle tertiary   
24028           415.354747      Short-cycle tertiary   
24056           414.844973            Post-secondary   
24062           266.489227            Post-secondary   
24167           300.169220           Early childhood   

             Education - Mother  Out-of-School Study Time - Total  \
409    Bachelor’s or equivalent                              48.0   
656    Bachelor’s or equivalent                               7.0   
780    Bachelor’s or equivalent                               1.0   
792    Bachelor’s or equivalent                              20.0   
1120   Bachelor’s or equivalent                              14.0   
1139   Bachelor’s or equivalent                               5.0   
1468   Bachelor’s or equivalent                               5.0   
1587   Bachelor’s or equivalent                              43.0   
1605   Bachelor’s or equivalent                               7.0   
1627   Bachelor’s or equivalent                               5.0   
1986   Bachelor’s or equivalent                               3.0   
2066   Bachelor’s or equivalent                              11.0   
2244   Bachelor’s or equivalent                               2.0   
2291   Bachelor’s or equivalent                              16.0   
2646   Bachelor’s or equivalent                               6.0   
3304       Short-cycle tertiary                               3.0   
3343       Short-cycle tertiary                               3.0   
3742       Short-cycle tertiary                               3.0   
3769       Short-cycle tertiary                               9.0   
3846       Short-cycle tertiary                               6.0   
4022       Short-cycle tertiary                               5.0   
4076       Short-cycle tertiary                               7.0   
4227       Short-cycle tertiary                               3.0   
4257       Short-cycle tertiary                               1.0   
4329       Short-cycle tertiary                               2.0   
4339       Short-cycle tertiary                               8.0   
4412       Short-cycle tertiary                              10.0   
4502       Short-cycle tertiary                               4.0   
4512       Short-cycle tertiary                               9.0   
4627       Short-cycle tertiary                               5.0   
...                         ...                               ...   
16895           Upper secondary                               1.0   
17294           Upper secondary                               3.0   
17298           Upper secondary                               6.0   
17302           Upper secondary                               6.0   
17303           Upper secondary                               1.0   
17324           Upper secondary                               1.0   
17426           Upper secondary                               7.0   
17427           Upper secondary                              12.0   
17634           Upper secondary                               0.0   
17701           Upper secondary                               6.0   
18021           Upper secondary                               7.0   
18139           Upper secondary                               6.0   
19061           Upper secondary                               7.0   
19298           Upper secondary                               1.0   
19394           Upper secondary                               4.0   
20583           Lower secondary                               7.0   
21240           Lower secondary                              15.0   
21505           Lower secondary                              13.0   
22263           Lower secondary                               4.0   
22377           Lower secondary                               4.0   
22734           Lower secondary                               9.0   
23165           Lower secondary                               1.0   
23302           Lower secondary                               5.0   
23502                   Primary                               5.0   
23781                   Primary                               1.0   
24017           Early childhood                               0.0   
24028           Early childhood                               2.0   
24056           Early childhood                              20.0   
24062           Early childhood                              72.0   
24167           Early childhood                               1.0   

       Learning Time - Total  
409                   1380.0  
656                   2080.0  
780                   1690.0  
792                   1950.0  
1120                  1920.0  
1139                  1860.0  
1468                  1800.0  
1587                  1890.0  
1605                  2430.0  
1627                  2160.0  
1986                  2250.0  
2066                  1890.0  
2244                  1620.0  
2291                  1710.0  
2646                  1890.0  
3304                  1500.0  
3343                  1920.0  
3742                  1974.0  
3769                  1500.0  
3846                  1845.0  
4022                  1215.0  
4076                  2160.0  
4227                  1890.0  
4257                  2415.0  
4329                  1680.0  
4339                  2070.0  
4412                  1530.0  
4502                  1800.0  
4512                  2160.0  
4627                  1806.0  
...                      ...  
16895                 2400.0  
17294                 1800.0  
17298                 1980.0  
17302                 1980.0  
17303                 2700.0  
17324                 1620.0  
17426                 1800.0  
17427                 1710.0  
17634                 1248.0  
17701                 1440.0  
18021                 2400.0  
18139                 1600.0  
19061                 2625.0  
19298                 2100.0  
19394                 2400.0  
20583                 2640.0  
21240                 2880.0  
21505                 1170.0  
22263                 1125.0  
22377                 2640.0  
22734                 1530.0  
23165                 1860.0  
23302                 1395.0  
23502                 1600.0  
23781                 2200.0  
24017                 1575.0  
24028                 2280.0  
24056                 1100.0  
24062                 1890.0  
24167                 1350.0  

[105 rows x 19 columns]
In [31]:
high_outliers_sci = (pisa['Learning Time - Science'] > 600)

print(high_outliers_lang.sum())
print(pisa.loc[high_outliers_sci,:])
105
                        Country  Student ID  Gender  \
193                  Kazakhstan        3188  Female   
206                  Kazakhstan        4894    Male   
306                  Kazakhstan        1403  Female   
309                  Kazakhstan        1110    Male   
350              United Kingdom        9960    Male   
373              United Kingdom        7553  Female   
584             Hong Kong-China        4336    Male   
656         Massachusetts (USA)        1658    Male   
735              China-Shanghai        5053    Male   
792    United States of America        2195    Male   
871                 New Zealand         258    Male   
913                 New Zealand        4147    Male   
1059                   Portugal        2447    Male   
1387                     Brazil       18569  Female   
1402                     Brazil       17671  Female   
1433       United Arab Emirates        4954  Female   
1440       United Arab Emirates        4740  Female   
1466       United Arab Emirates        5132  Female   
1471       United Arab Emirates        7626  Female   
1480       United Arab Emirates        6450    Male   
1484       United Arab Emirates        6230    Male   
1501       United Arab Emirates        2681  Female   
1587       United Arab Emirates        8673    Male   
1600       United Arab Emirates       11338  Female   
1605       United Arab Emirates       10226    Male   
1609       United Arab Emirates       10997    Male   
1963                     Canada       11249    Male   
1986                     Canada       14395  Female   
2024                     Canada       14277  Female   
2047                      Chile        2646    Male   
...                         ...         ...     ...   
17524            United Kingdom        1404  Female   
17546           Hong Kong-China         314    Male   
18021                    Canada       10153    Male   
18028                     Spain       13305  Female   
18139                    Canada       10176    Male   
18234                    Canada       15443    Male   
18653                    Canada       21104    Male   
19061            United Kingdom       11879  Female   
19145            United Kingdom       10271    Male   
19170            United Kingdom       12384    Male   
19205            United Kingdom        8214    Male   
19298                    Canada       18263    Male   
19366                 Australia        8626    Male   
19394                    Canada       10165    Male   
20005      United Arab Emirates       10220    Male   
20204               Switzerland        6058    Male   
20856               Switzerland       10401  Female   
20912      United Arab Emirates        8678    Male   
21240                     Spain       23856  Female   
21459                    Canada       14236  Female   
21889                     Spain       21397    Male   
22118      United Arab Emirates        9897  Female   
22377                     Chile         505    Male   
23563                     Spain       24654  Female   
23781                    Canada       18264    Male   
23968                  Portugal        1198    Male   
24006      United Arab Emirates        4024  Female   
24028                     Spain       21983    Male   
24062      United Arab Emirates        8650    Male   
24087      United Arab Emirates        6165  Female   

       Out-of-School Study Time - Homework  \
193                                    2.0   
206                                    7.0   
306                                   12.0   
309                                    6.0   
350                                    4.0   
373                                   12.0   
584                                    4.0   
656                                    6.0   
735                                   18.0   
792                                   10.0   
871                                    4.0   
913                                    4.0   
1059                                   4.0   
1387                                   4.0   
1402                                   4.0   
1433                                   3.0   
1440                                   3.0   
1466                                   2.0   
1471                                   8.0   
1480                                  16.0   
1484                                  30.0   
1501                                  10.0   
1587                                  10.0   
1600                                  14.0   
1605                                   5.0   
1609                                   2.0   
1963                                   7.0   
1986                                   1.0   
2024                                   4.0   
2047                                   1.0   
...                                    ...   
17524                                  7.0   
17546                                  2.0   
18021                                  7.0   
18028                                 21.0   
18139                                  6.0   
18234                                  6.0   
18653                                  0.0   
19061                                  6.0   
19145                                 10.0   
19170                                 10.0   
19205                                  1.0   
19298                                  1.0   
19366                                  8.0   
19394                                  2.0   
20005                                  4.0   
20204                                  4.0   
20856                                 10.0   
20912                                  6.0   
21240                                  5.0   
21459                                  4.0   
21889                                 10.0   
22118                                  3.0   
22377                                  3.0   
23563                                  3.0   
23781                                  1.0   
23968                                  7.0   
24006                                 28.0   
24028                                  2.0   
24062                                 14.0   
24087                                  5.0   

       Out-of-School Study Time - Guided Homework  \
193                                           1.0   
206                                           7.0   
306                                          10.0   
309                                           5.0   
350                                           0.0   
373                                           3.0   
584                                           0.0   
656                                           0.0   
735                                          15.0   
792                                           5.0   
871                                           0.0   
913                                           1.0   
1059                                          0.0   
1387                                          3.0   
1402                                          0.0   
1433                                          1.0   
1440                                          0.0   
1466                                          0.0   
1471                                          2.0   
1480                                          2.0   
1484                                          2.0   
1501                                          0.0   
1587                                         10.0   
1600                                          5.0   
1605                                          1.0   
1609                                          1.0   
1963                                          1.0   
1986                                          1.0   
2024                                          0.0   
2047                                          1.0   
...                                           ...   
17524                                         0.0   
17546                                         0.0   
18021                                         0.0   
18028                                         0.0   
18139                                         0.0   
18234                                         1.0   
18653                                         0.0   
19061                                         1.0   
19145                                         0.0   
19170                                         2.0   
19205                                         0.0   
19298                                         0.0   
19366                                         0.0   
19394                                         2.0   
20005                                         0.0   
20204                                         4.0   
20856                                         5.0   
20912                                         3.0   
21240                                         5.0   
21459                                         1.0   
21889                                         0.0   
22118                                         1.0   
22377                                         1.0   
23563                                         2.0   
23781                                         0.0   
23968                                         2.0   
24006                                         7.0   
24028                                         0.0   
24062                                        14.0   
24087                                         1.0   

       Out-of-School Study Time - Personal Tutor  \
193                                          2.0   
206                                          0.0   
306                                          4.0   
309                                          0.0   
350                                          0.0   
373                                          2.0   
584                                          0.0   
656                                          0.0   
735                                          0.0   
792                                          0.0   
871                                          0.0   
913                                          0.0   
1059                                         0.0   
1387                                         8.0   
1402                                         0.0   
1433                                         0.0   
1440                                         0.0   
1466                                         4.0   
1471                                         0.0   
1480                                         6.0   
1484                                         0.0   
1501                                         0.0   
1587                                        10.0   
1600                                         2.0   
1605                                         0.0   
1609                                         0.0   
1963                                         0.0   
1986                                         0.0   
2024                                         0.0   
2047                                         1.0   
...                                          ...   
17524                                        0.0   
17546                                        0.0   
18021                                        0.0   
18028                                        0.0   
18139                                        0.0   
18234                                        0.0   
18653                                        0.0   
19061                                        0.0   
19145                                        0.0   
19170                                        0.0   
19205                                        0.0   
19298                                        0.0   
19366                                        0.0   
19394                                        0.0   
20005                                        4.0   
20204                                        1.0   
20856                                        0.0   
20912                                        1.0   
21240                                        5.0   
21459                                        0.0   
21889                                        0.0   
22118                                        4.0   
22377                                        0.0   
23563                                        1.0   
23781                                        0.0   
23968                                        2.0   
24006                                        0.0   
24028                                        0.0   
24062                                       14.0   
24087                                        0.0   

       Out-of-School Study Time - Commercial Company  \
193                                              4.0   
206                                              0.0   
306                                              4.0   
309                                              0.0   
350                                              0.0   
373                                              1.0   
584                                              4.0   
656                                              0.0   
735                                              6.0   
792                                              0.0   
871                                              0.0   
913                                              0.0   
1059                                             0.0   
1387                                             8.0   
1402                                             0.0   
1433                                             1.0   
1440                                             0.0   
1466                                             0.0   
1471                                             0.0   
1480                                             0.0   
1484                                             0.0   
1501                                             0.0   
1587                                            10.0   
1600                                             0.0   
1605                                             0.0   
1609                                             0.0   
1963                                             0.0   
1986                                             0.0   
2024                                             0.0   
2047                                             1.0   
...                                              ...   
17524                                            0.0   
17546                                            0.0   
18021                                            0.0   
18028                                            1.0   
18139                                            0.0   
18234                                            0.0   
18653                                            0.0   
19061                                            0.0   
19145                                            0.0   
19170                                            0.0   
19205                                            0.0   
19298                                            0.0   
19366                                            0.0   
19394                                            0.0   
20005                                            0.0   
20204                                            4.0   
20856                                            0.0   
20912                                            4.0   
21240                                            0.0   
21459                                            0.0   
21889                                            3.0   
22118                                            2.0   
22377                                            0.0   
23563                                            3.0   
23781                                            0.0   
23968                                            2.0   
24006                                            0.0   
24028                                            0.0   
24062                                           15.0   
24087                                            0.0   

       Out-of-School Study Time - With Parent  Learning Time - Mathematics  \
193                                       1.0                        180.0   
206                                       0.0                        810.0   
306                                       0.0                        540.0   
309                                       0.0                        180.0   
350                                       1.0                        225.0   
373                                       0.0                        330.0   
584                                       0.0                        350.0   
656                                       1.0                        720.0   
735                                       0.0                        315.0   
792                                       5.0                        650.0   
871                                       0.0                        400.0   
913                                       1.0                        250.0   
1059                                      0.0                        270.0   
1387                                      1.0                        250.0   
1402                                      0.0                        315.0   
1433                                      2.0                        200.0   
1440                                      0.0                        360.0   
1466                                      0.0                        250.0   
1471                                      1.0                        270.0   
1480                                      4.0                        400.0   
1484                                      2.0                        240.0   
1501                                      0.0                        200.0   
1587                                      3.0                        630.0   
1600                                     10.0                        270.0   
1605                                      1.0                        540.0   
1609                                      3.0                        270.0   
1963                                      1.0                        400.0   
1986                                      1.0                        750.0   
2024                                      0.0                        720.0   
2047                                      2.0                        360.0   
...                                       ...                          ...   
17524                                     1.0                        400.0   
17546                                     0.0                        225.0   
18021                                     0.0                        800.0   
18028                                     1.0                        220.0   
18139                                     0.0                          0.0   
18234                                     1.0                        240.0   
18653                                     0.0                        200.0   
19061                                     0.0                        875.0   
19145                                     3.0                        330.0   
19170                                     2.0                        480.0   
19205                                     0.0                        270.0   
19298                                     0.0                        700.0   
19366                                     0.0                        630.0   
19394                                     0.0                        800.0   
20005                                     0.0                        300.0   
20204                                     4.0                        180.0   
20856                                     3.0                        225.0   
20912                                     5.0                        630.0   
21240                                     0.0                        960.0   
21459                                     1.0                        450.0   
21889                                     0.0                        220.0   
22118                                     0.0                        330.0   
22377                                     0.0                        840.0   
23563                                     2.0                        180.0   
23781                                     0.0                        650.0   
23968                                     3.0                        540.0   
24006                                     0.0                        270.0   
24028                                     0.0                        720.0   
24062                                    15.0                        630.0   
24087                                     1.0                        720.0   

       Learning Time - Test Language  Learning Time - Science  \
193                             90.0                   1125.0   
206                             45.0                   1350.0   
306                             90.0                    630.0   
309                            135.0                    900.0   
350                            225.0                    675.0   
373                            330.0                    660.0   
584                            420.0                   1080.0   
656                            720.0                    640.0   
735                            320.0                    825.0   
792                            650.0                    650.0   
871                            400.0                    800.0   
913                            250.0                   2250.0   
1059                           180.0                    630.0   
1387                           250.0                    700.0   
1402                           180.0                    675.0   
1433                           160.0                    960.0   
1440                           360.0                    720.0   
1466                           220.0                    770.0   
1471                           270.0                    675.0   
1480                           400.0                    900.0   
1484                           240.0                    720.0   
1501                           560.0                    720.0   
1587                           630.0                    630.0   
1600                           270.0                    675.0   
1605                           810.0                   1080.0   
1609                           270.0                    630.0   
1963                           400.0                    800.0   
1986                           750.0                    750.0   
2024                           180.0                    720.0   
2047                           540.0                    720.0   
...                              ...                      ...   
17524                          400.0                    960.0   
17546                          270.0                   1260.0   
18021                          800.0                    800.0   
18028                          220.0                    660.0   
18139                          800.0                    800.0   
18234                          240.0                    640.0   
18653                          200.0                    800.0   
19061                          875.0                    875.0   
19145                          330.0                    660.0   
19170                          480.0                    720.0   
19205                          180.0                    900.0   
19298                          700.0                    700.0   
19366                          210.0                    630.0   
19394                          800.0                    800.0   
20005                          540.0                   1040.0   
20204                          180.0                   1980.0   
20856                          270.0                   1530.0   
20912                          540.0                    675.0   
21240                          960.0                    960.0   
21459                          450.0                    675.0   
21889                          165.0                    660.0   
22118                          330.0                    660.0   
22377                          840.0                    960.0   
23563                          180.0                    720.0   
23781                          800.0                    750.0   
23968                          360.0                    630.0   
24006                          270.0                   2025.0   
24028                          720.0                    840.0   
24062                          630.0                    630.0   
24087                          280.0                    720.0   

       Average_Math_Score  Average_Reading_Score  Average_Science_Score  \
193             450.23366              476.74890              421.61508   
206             519.71490              427.25806              482.97276   
306             517.84546              400.17738              502.74148   
309             368.60104              276.01124              340.67512   
350             682.82444              640.01412              654.27078   
373             558.11654              504.62916              565.40468   
584             697.07898              604.24736              697.63148   
656             472.74498              446.74536              548.99290   
735             681.42236              577.22182              665.55390   
792             455.21890              457.73198              526.98618   
871             641.54072              579.30686              647.37038   
913             639.20396              558.53648              624.99066   
1059            727.92490              678.18670              656.04252   
1387            521.89594              550.46086              472.34240   
1402            571.82582              612.09932              543.11822   
1433            418.99828              498.35412              483.99850   
1440            452.72628              501.21362              506.28496   
1466            574.94156              604.87110              586.85190   
1471            442.44432              452.28412              446.60574   
1480            522.75278              499.03216              529.87692   
1484            722.23866              727.34592              759.73518   
1501            558.11654              588.74662              600.65274   
1587            367.04312              258.04766              366.59828   
1600            485.05218              505.97950              531.36888   
1605            665.76568              606.57300              707.23610   
1609            476.56178              458.85472              477.00486   
1963            676.74872              625.98008              665.74040   
1986            486.29850              465.54912              497.33308   
2024            508.96558              499.46614              429.54122   
2047            417.98566              414.26656              457.23612   
...                   ...                    ...                    ...   
17524           760.71820              734.02590              708.63486   
17546           555.23446              575.05656              541.81276   
18021           594.25920              619.88530              619.02276   
18028           597.76444              627.90610              588.25064   
18139           526.80326              513.62758              551.04438   
18234           619.18524              613.22914              542.83848   
18653           492.76370              492.85720              525.30770   
19061           574.39634              588.11116              576.59456   
19145           590.75400              539.28980              583.77470   
19170           551.88502              586.84512              599.06750   
19205           637.64604              594.78440              674.22602   
19298           462.22932              470.56310              474.02090   
19366           665.45412              607.29476              653.05858   
19394           426.32030              470.96410              491.36514   
20005           587.48248              532.15248              614.26708   
20204           379.97354              374.65048              410.05222   
20856           480.76804              504.31144              476.44536   
20912           414.48044              413.78540              419.28386   
21240           371.71680              354.02796              372.00670   
21459           539.26624              500.73704              497.23986   
21889           625.26094              650.59978              594.31182   
22118           403.26374              427.73994              451.73442   
22377           542.61564              490.93250              520.17904   
23563           418.37512              454.74652              393.64044   
23781           355.51488              348.10612              328.55278   
23968           568.71010              465.02970              533.32712   
24006           489.88160              522.10398              514.21112   
24028           376.23462              383.87286              485.95676   
24062           244.59418              259.33080              295.54270   
24087           492.60786              531.39742              478.31034   

       Average_Total_Score        Education - Father  \
193             449.532547  Bachelor’s or equivalent   
206             476.648573  Bachelor’s or equivalent   
306             473.588107  Bachelor’s or equivalent   
309             328.429133  Bachelor’s or equivalent   
350             659.036447  Bachelor’s or equivalent   
373             542.716793  Bachelor’s or equivalent   
584             666.319273  Bachelor’s or equivalent   
656             489.494413  Bachelor’s or equivalent   
735             641.399360  Bachelor’s or equivalent   
792             479.979020  Bachelor’s or equivalent   
871             622.739320  Bachelor’s or equivalent   
913             607.577033  Bachelor’s or equivalent   
1059            687.384707  Bachelor’s or equivalent   
1387            514.899733  Bachelor’s or equivalent   
1402            575.681120  Bachelor’s or equivalent   
1433            467.116967  Bachelor’s or equivalent   
1440            486.741620  Bachelor’s or equivalent   
1466            588.888187  Bachelor’s or equivalent   
1471            447.111393  Bachelor’s or equivalent   
1480            517.220620  Bachelor’s or equivalent   
1484            736.439920  Bachelor’s or equivalent   
1501            582.505300  Bachelor’s or equivalent   
1587            330.563020  Bachelor’s or equivalent   
1600            507.466853  Bachelor’s or equivalent   
1605            659.858260  Bachelor’s or equivalent   
1609            470.807120  Bachelor’s or equivalent   
1963            656.156400  Bachelor’s or equivalent   
1986            483.060233  Bachelor’s or equivalent   
2024            479.324313  Bachelor’s or equivalent   
2047            429.829447  Bachelor’s or equivalent   
...                    ...                       ...   
17524           734.459653  Bachelor’s or equivalent   
17546           557.367927  Bachelor’s or equivalent   
18021           611.055753      Short-cycle tertiary   
18028           604.640393      Short-cycle tertiary   
18139           530.491740      Short-cycle tertiary   
18234           591.750953      Short-cycle tertiary   
18653           503.642867            Post-secondary   
19061           579.700687      Short-cycle tertiary   
19145           571.272833           Upper secondary   
19170           579.265880           Upper secondary   
19205           635.552153           Upper secondary   
19298           468.937773           Upper secondary   
19366           641.935820           Upper secondary   
19394           462.883180           Upper secondary   
20005           577.967347      Short-cycle tertiary   
20204           388.225413      Short-cycle tertiary   
20856           487.174947           Lower secondary   
20912           415.849900           Lower secondary   
21240           365.917153                   Primary   
21459           512.414380           Upper secondary   
21889           623.390847           Upper secondary   
22118           427.579367      Short-cycle tertiary   
22377           517.909060      Short-cycle tertiary   
23563           422.254027                   Primary   
23781           344.057927            Post-secondary   
23968           522.355640  Bachelor’s or equivalent   
24006           508.732233  Bachelor’s or equivalent   
24028           415.354747      Short-cycle tertiary   
24062           266.489227            Post-secondary   
24087           500.771873           Upper secondary   

             Education - Mother  Out-of-School Study Time - Total  \
193    Bachelor’s or equivalent                              10.0   
206    Bachelor’s or equivalent                              14.0   
306    Bachelor’s or equivalent                              30.0   
309    Bachelor’s or equivalent                              11.0   
350    Bachelor’s or equivalent                               5.0   
373    Bachelor’s or equivalent                              18.0   
584    Bachelor’s or equivalent                               8.0   
656    Bachelor’s or equivalent                               7.0   
735    Bachelor’s or equivalent                              39.0   
792    Bachelor’s or equivalent                              20.0   
871    Bachelor’s or equivalent                               4.0   
913    Bachelor’s or equivalent                               6.0   
1059   Bachelor’s or equivalent                               4.0   
1387   Bachelor’s or equivalent                              24.0   
1402   Bachelor’s or equivalent                               4.0   
1433   Bachelor’s or equivalent                               7.0   
1440   Bachelor’s or equivalent                               3.0   
1466   Bachelor’s or equivalent                               6.0   
1471   Bachelor’s or equivalent                              11.0   
1480   Bachelor’s or equivalent                              28.0   
1484   Bachelor’s or equivalent                              34.0   
1501   Bachelor’s or equivalent                              10.0   
1587   Bachelor’s or equivalent                              43.0   
1600   Bachelor’s or equivalent                              31.0   
1605   Bachelor’s or equivalent                               7.0   
1609   Bachelor’s or equivalent                               6.0   
1963   Bachelor’s or equivalent                               9.0   
1986   Bachelor’s or equivalent                               3.0   
2024   Bachelor’s or equivalent                               4.0   
2047   Bachelor’s or equivalent                               6.0   
...                         ...                               ...   
17524           Upper secondary                               8.0   
17546           Upper secondary                               2.0   
18021           Upper secondary                               7.0   
18028           Upper secondary                              23.0   
18139           Upper secondary                               6.0   
18234           Upper secondary                               8.0   
18653           Upper secondary                               0.0   
19061           Upper secondary                               7.0   
19145           Upper secondary                              13.0   
19170           Upper secondary                              14.0   
19205           Upper secondary                               1.0   
19298           Upper secondary                               1.0   
19366           Upper secondary                               8.0   
19394           Upper secondary                               4.0   
20005           Upper secondary                               8.0   
20204           Upper secondary                              17.0   
20856           Lower secondary                              18.0   
20912           Lower secondary                              19.0   
21240           Lower secondary                              15.0   
21459           Lower secondary                               6.0   
21889           Lower secondary                              13.0   
22118           Lower secondary                              10.0   
22377           Lower secondary                               4.0   
23563                   Primary                              11.0   
23781                   Primary                               1.0   
23968                   Primary                              16.0   
24006           Early childhood                              35.0   
24028           Early childhood                               2.0   
24062           Early childhood                              72.0   
24087           Early childhood                               7.0   

       Learning Time - Total  
193                   1395.0  
206                   2205.0  
306                   1260.0  
309                   1215.0  
350                   1125.0  
373                   1320.0  
584                   1850.0  
656                   2080.0  
735                   1460.0  
792                   1950.0  
871                   1600.0  
913                   2750.0  
1059                  1080.0  
1387                  1200.0  
1402                  1170.0  
1433                  1320.0  
1440                  1440.0  
1466                  1240.0  
1471                  1215.0  
1480                  1700.0  
1484                  1200.0  
1501                  1480.0  
1587                  1890.0  
1600                  1215.0  
1605                  2430.0  
1609                  1170.0  
1963                  1600.0  
1986                  2250.0  
2024                  1620.0  
2047                  1620.0  
...                      ...  
17524                 1760.0  
17546                 1755.0  
18021                 2400.0  
18028                 1100.0  
18139                 1600.0  
18234                 1120.0  
18653                 1200.0  
19061                 2625.0  
19145                 1320.0  
19170                 1680.0  
19205                 1350.0  
19298                 2100.0  
19366                 1470.0  
19394                 2400.0  
20005                 1880.0  
20204                 2340.0  
20856                 2025.0  
20912                 1845.0  
21240                 2880.0  
21459                 1575.0  
21889                 1045.0  
22118                 1320.0  
22377                 2640.0  
23563                 1080.0  
23781                 2200.0  
23968                 1530.0  
24006                 2565.0  
24028                 2280.0  
24062                 1890.0  
24087                 1720.0  

[220 rows x 19 columns]

Since the measure of outliers is so low and they don't carry uncommonly significant data to the investigation, it will be better in the event that we proceed without them.

In [32]:
pisa = pisa.loc[-high_outliers_math & -high_outliers_lang & -high_outliers_sci,:]

Now we can re-plot the distributions of learning times with more reliable plots

In [33]:
fig, ax = plt.subplots(nrows=3, figsize = [8,20])

variables = ['Learning Time - Mathematics', 'Learning Time - Test Language', 'Learning Time - Science']
for i in range(len(variables)):
    var = variables[i]
    ax[i].hist(data = pisa, x = var, color='purple')
    ax[i].set_xlabel('{} (mins/week)'.format(var))
    ax[i].set_ylabel('Frequency')
    ax[i].set_title('{}'.format(var))


plt.show()

To wrap things up, we actually have the parental education levels to analyze.

In [34]:
# The ordinal variable's distribution for both Mother's and Father's Education 
fig, ax = plt.subplots(nrows=2, figsize = [14,20])

default_color = sb.color_palette()[0]
vc_ef= pisa['Education - Father'].value_counts()
vc_em= pisa['Education - Mother'].value_counts()

sb.countplot(data = pisa, y = 'Education - Father', color = 'dodgerblue', ax = ax[0], order=vc_ef.index)
sb.countplot(data = pisa, y = 'Education - Mother', color = 'violet', ax = ax[1], order=vc_em.index)
plt.show()

Here it shows that the student that exist in this dataset normally have guardians of higher educationl levels. Short-cycle Tertiary schooling takes an unmistakable larger part for both mother and father, while parents with just Early Childhood educaution have the most minimal measure of kids in this dataset.

Discuss the distribution(s) of your variable(s) of interest. Were there any unusual points? Did you need to perform any transformations?

For 'Average Total Score', the distribution was strikingly ordinary. Nonetheless, this was expected to an extent, since student reviews commonly fall along a bell curve. Accordingly, no abnormal focuses stood apart for this variable, nor did any stand apart for the three scores that brought about the all out score. Consequently, no transformation were important to sort out the data.

Of the features you investigated, were there any unusual distributions? Did you perform any operations on the data to tidy, adjust, or change the form of the data? If so, why did you do this?

The secondary features investigated were Study Times, Learning Times, and Parental Schooling.

For Study Times, the total had a strong right skew, as did the rest of the Study Times that the all out was made out of. To more readily comprehend this component, we spread the complete across a logarithmic scale to check whether it was not indeed unimodal or to perceive some other anomalies. Eventually, it wound up being unimodal and very normal.

Concerning the Learning Time, this data plainly had outliers, so for every one of the Learning Time's, the exceptions more than 600 minutes were barred. This was done to take a gander at the more ordinary student results, thus that later plots will not be distorted by these exceptionally dedicated students.

Also, the Parents Education variables have altogether too much weight on parents with higher education levels, yet considering the plots we will run, this ought not have an great effect so we will leave it as is

Bivariate Exploration :Trends and Correlation

Out-of-School Study Time and Learning Time

To get going, we should take a look at the correlations between each of the Scores, the Total Out-of-School Study Time, and the Total Learning Time to see if the amount of time dedicated to a subject has an impact on the score, and how strongly the Scores are correlated with one another. This will help us answer the question of whether or not there is a relationship between the amount of time a student dedicates to learning and their score.

In [35]:
num_vars = ['Average_Math_Score', 'Average_Reading_Score', 'Average_Science_Score', 'Average_Total_Score', 'Out-of-School Study Time - Total', 'Learning Time - Total']
In [36]:
# Correlation plot
cmap=sb.diverging_palette(20, 220, n=200)
plt.figure(figsize = [8, 5])
sb.heatmap(pisa[num_vars].corr(), annot = True, fmt = '.3f',
           cmap = cmap, center = 0)
plt.show();

Considering the correlations between the Scores, the Total Out-of-School Study Time and Total Learning Time, we can see that the Total Learning Time is a little better correlated with the scores than the Total Out-of-School Study Time, with the Average Reading Score being the exception.

To more readily understand the relationship between the Scores and the Learning Time, lets look at the breakdown of each of the Learning Time per subject.

In [37]:
ScoreLearnVars = ['Average_Math_Score', 'Average_Reading_Score', 'Average_Science_Score', 
                    'Average_Total_Score', 'Learning Time - Mathematics',
                    'Learning Time - Test Language', 'Learning Time - Science', 
                    'Learning Time - Total']
In [38]:
# correlation plot
plt.figure(figsize = [8, 5])

sb.heatmap(pisa[ScoreLearnVars].corr(), annot = True, fmt = '.3f',
           cmap = cmap, center = 0)
plt.show();

Strangely, we can see that the Learning Time for Mathematics and the Test Language have no relationship at all with any of the Scores when contrasted with the Learning Time for Science.

We can look at these vars now through another perspective: look at the scatter plot relationships between them

In [39]:
# Take a samples to play with it
samples = np.random.choice(pisa.shape[0], 500, replace = False)
pisa_samp = pisa.loc[samples,:]

g = sb.PairGrid(data = pisa_samp, vars = ScoreLearnVars)
g = g.map_diag(plt.hist, bins = 20, color='orange');
g.map_offdiag(plt.scatter, color = 'skyblue');
C:\Users\j stock\Anaconda3\lib\site-packages\pandas\core\indexing.py:1472: FutureWarning: 
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.

See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
  return self._getitem_tuple(key)
C:\Users\j stock\Anaconda3\lib\site-packages\numpy\lib\histograms.py:754: RuntimeWarning: invalid value encountered in greater_equal
  keep = (tmp_a >= first_edge)
C:\Users\j stock\Anaconda3\lib\site-packages\numpy\lib\histograms.py:755: RuntimeWarning: invalid value encountered in less_equal
  keep &= (tmp_a <= last_edge)

As expected, we can clearly see a strong positive relationship between each of the Scores. As for the correlations between the Learning Times, a positive relationship is visual between each of them, yet not extremely solid except for certain outliers.

With regards to the relationship between the Scores and Learning Times, we can see that the measure of time an examination spends learning a subject has no relationship with the Score that they will get as per this plot.

In [40]:
ScoreStudyVars = ['Average_Math_Score', 'Average_Reading_Score', 'Average_Science_Score', 
                    'Average_Total_Score', 'Out-of-School Study Time - Homework',
                    'Out-of-School Study Time - Guided Homework',
                    'Out-of-School Study Time - Personal Tutor',
                    'Out-of-School Study Time - Commercial Company',
                    'Out-of-School Study Time - With Parent', 
                    'Out-of-School Study Time - Total']
In [41]:
# correlation plot
plt.figure(figsize = [8, 5])
sb.heatmap(pisa[ScoreStudyVars].corr(), annot = True, fmt = '.3f',
           cmap = cmap, center = 0)
plt.show();

The consequences of this relationship plot are recognizable in that it denotes that study time as far as Guided Homework, with Personal Tutor, with a Commercial Company, and with a Parent have no certain effect on the score of an student. This could be identified with the way that the students who do require this measure of help are now the ones who battle with grades, however since we have no data on past Scores of said students, we can't investigate this hypothesis any further for the now.

We can notwithstanding, look further into the part of Homework in the students Scores

In [42]:
ScoreStudyVars = ['Average_Math_Score', 'Average_Reading_Score', 'Average_Science_Score', 
                'Average_Total_Score', 'Out-of-School Study Time - Homework']
In [43]:
# Take a samples to play with it
samples = np.random.choice(pisa.shape[0], 500, replace = False)
pisa_samp = pisa.loc[samples,:] 

g = sb.PairGrid(data = pisa_samp, vars = ScoreStudyVars)
g = g.map_diag(plt.hist, bins = 20, color='orange');
g.map_offdiag(plt.scatter, color = 'skyblue');

Albeit the correlation between Homework Study Time and every one of the different Scores is frail, we can see that the additional time an student spends on Homework, the higher their Score is. However, this relationship just truly exists until the Score is around 450. So for the students who are at the lower part of the Scoring rank invest energy doing Homework, at that point they can move into the normal Scores. Concerning the higher Scores, appears as though they are by and large unaffected.

Finally, we should take a look at the connection between the Study Time and Learning Time Vars to check whether they emphatically with each other in any intriguing manner.

In [44]:
timeVars = ['Out-of-School Study Time - Homework',
            'Out-of-School Study Time - Guided Homework',
            'Out-of-School Study Time - Personal Tutor',
            'Out-of-School Study Time - Commercial Company',
            'Out-of-School Study Time - With Parent',
            'Learning Time - Mathematics',
            'Learning Time - Test Language',
            'Learning Time - Science']
In [45]:
# correlation plot
plt.figure(figsize = [8, 5])

sb.heatmap(pisa[timeVars].corr(), annot = True, fmt = '.3f',
           cmap = cmap, center = 0)
plt.show();

With regards to the Study Times and Learning Times, no relationship is noticeable, and they scarcely have any associations with the actual classes. Along these lines, we can't say that specific students concentrate inside school and outside of school more than others. Overall for this segment, we can't see a lot of an impact from Time spent learning on Scores.

Presently we can see our next set of vars that may impact the Score of an student:

Parental Education & Gender

To get going, how about we take a look at the circulation of each level of education and the recurrence of each.

In [46]:
g = sb.FacetGrid(data = pisa, col = 'Education - Mother');
g.map(plt.hist, 'Average_Total_Score', color = 'violet');

Here we can see that the youngsters in this dataset regularly have moms with a Short-cycle Tertiary Educ. As far as Scores for each level, kids with moms who have just Early Childhood education perform a lot of more terrible, with distribution that doesn't arrive at the Score of 600. In the interim, the most elevated level of Bachelor's or equivalent is slightly left skewed and goes past the 600 mark.

In [47]:
g = sb.FacetGrid(data = pisa, col = 'Education - Father');
g.map(plt.hist, 'Average_Total_Score', color = 'dodgerblue');

The equivalent can be said for the training levels for the fathers. Besides here we have more fathers with Bachelor's or equivalent educations.

Next we can take a look at the distribution for every one of these levels to see the reach and medians better.

In [48]:
plt.figure(figsize=[14,8])
sb.violinplot(data = pisa, 
              x = 'Education - Father', 
              y = 'Average_Total_Score',
              color = 'skyblue')
plt.title('Average Total Score Across Education Levels of Father');
C:\Users\j stock\Anaconda3\lib\site-packages\scipy\stats\stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval

Curiously, the spread is very huge for the offspring of higher educated fathers. Truth be told, apparently the kid who performed most noticeably awful had a dad with Short-cycle Tertiary eductation. Then, the kids with parents who have just Youth schooling appear to have a lot more modest reach and exist to a much greater extent around the middle.

In [49]:
plt.figure(figsize=[14,8])
sb.violinplot(data = pisa, 
              x = 'Education - Mother', 
              y = 'Average_Total_Score', 
              color = 'violet')
plt.title('Average Total Score Across Education Levels of Mother');

The violin plot for the Mother's education is more as per what we expect, with the middle developing starting with one level then onto the next, and every one of which has a sensible spread.

Yet, to see the extent to which the outliers assume a part, we can take a look at similar data with box plots.

In [50]:
plt.figure(figsize=[14,8])
sb.boxplot(data = pisa, 
              x = 'Education - Father', 
              y = 'Average_Total_Score',
              color = 'skyblue');
plt.xticks(rotation = 20)
plt.title('Average Total Score Across Education Levels of Father');

Once again we can see the student who performs most minimal by and large is an outlier for the Short-cycle Tertiary level, and overall a similar trend exists.

In [51]:
plt.figure(figsize=[14,8])
sb.boxplot(data = pisa, 
              x = 'Education - Mother', 
              y = 'Average_Total_Score',
              color = 'violet')
plt.xticks(rotation = 20)
plt.title('Average Total Score Across Education Levels of Mother');

Here we can see that for the lower education levels for the mother, the students are by and large accomplishing lower grades, yet there are a decent measure of high score outliers. While on the other portion of the education levels, there is a propensity for high grades with a couple of low score outliers.

In [52]:
# Score averages of students Vs. education levels of Father
plt.figure(figsize=[14,8])
sb.pointplot(data = pisa, 
            x = 'Education - Father', 
            y = 'Average_Total_Score',
            color = 'skyblue')

# Score averages of students Vs. education levels of Mother
sb.pointplot(data = pisa, 
            x = 'Education - Mother', 
            y = 'Average_Total_Score',
            color = 'violet')

plt.title('Average Total Score Across Education Levels of Parents')

# Set legend
plt.legend(labels=['Fathers Education', 'Mothers Education'], loc='upper left', fontsize='large')
#https://stackoverflow.com/questions/44880444/how-to-increase-the-font-size-of-the-legend-in-my-seaborn-plot
ax = plt.gca()
plt.xticks(rotation = 12)
leg = ax.get_legend()
leg.legendHandles[0].set_color('skyblue')
leg.legendHandles[1].set_color('violet');

When all is said in done, we can see that the student Scores develop with the education level of the parent, regardless of the gender of the parent, until a point where it appears to level.

Presently we can move towards viewing at the gender of the child also.

In [53]:
plt.figure(figsize=[10,8])

sb.boxplot(data = pisa, 
           x = 'Gender', 
           y = 'Average_Total_Score',
           palette = ['skyblue', 'violet']);

If we look at the job that Gender plays on the Score, the reach appears to coordinate. Be that as it may, the males appear to plunge lower with their outliers.

In [54]:
plt.figure(figsize=[18,7])

sb.countplot(data = pisa, x = 'Education - Father', hue = 'Gender', palette = ['skyblue', 'violet']);

Here we can perceive the number of female and male children have parents that fall into the educational levels. It's for the most part about the equivalent, except for Bachelor's or equivalent, where there are a lot a bigger number of males than females.

Presently we can take a gander at whether gender assumes a part in the Score of an student

In [55]:
# Create a subset to better see comparison plots
np.random.seed(2018)
sample = np.random.choice(pisa.shape[0], 200, replace=False)
pisa_subset = pisa.loc[sample]
C:\Users\j stock\Anaconda3\lib\site-packages\ipykernel_launcher.py:4: FutureWarning: 
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.

See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/indexing.html#deprecate-loc-reindex-listlike
  after removing the cwd from sys.path.
In [56]:
g = sb.FacetGrid(data = pisa_subset, hue = 'Gender', palette = ['skyblue', 'violet'], height=5)
g.map(sb.regplot, 'Average_Total_Score', 'Average_Reading_Score', fit_reg = False)
plt.legend(fontsize= 'large');

Here we can see that females have a propensity for higher Reading Scores, and males have an inclination for higher Number Math Scores.

In [57]:
g = sb.FacetGrid(data = pisa_subset, hue = 'Gender', palette = ['skyblue', 'violet'], height=5)
g.map(sb.regplot, 'Average_Total_Score', 'Average_Science_Score', fit_reg = False)
plt.legend(fontsize= 'large');

A similar partition can't be made when contrasting Math with Science for male and female. They appear to cover totally.

In [58]:
g = sb.FacetGrid(data = pisa_subset, hue = 'Gender', palette = ['skyblue', 'violet'], height=5)
g.map(sb.regplot, 'Average_Total_Score', 'Average_Math_Score', fit_reg = False)
plt.legend(fontsize= 'large');

Once again, females beat a piece with regards to males and the Reading Score.

In [59]:
# Try with Study Time - Homework
g = sb.FacetGrid(data = pisa_subset, hue = 'Gender', palette = ['skyblue', 'violet'], height=5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Homework', fit_reg = False)
plt.legend(loc = 'upper left', fontsize= 'large');

With regards to the one Out-of-School Study Time variable that had any significant connection from previously, the Homework variable here has an irrelevant relationship to Score, as well as Gender

In [60]:
# Try with Learning Time - Science
g = sb.FacetGrid(data = pisa_subset, hue = 'Gender', palette = ['skyblue', 'violet'], height=5)
g.map(sb.regplot, 'Average_Science_Score', 'Learning Time - Science', fit_reg = False)
plt.legend(loc = 'upper left', fontsize= 'large');

Likewise with the Out-of-School Study Time variable, we can take a gander at the Science Score versus the Science Score here since it was the most grounded relationship. Indeed, the impact of Gender isn't noticeable.

Talk about some of the relationships you observed in this part of the investigation. How did the feature(s) of interest vary with other features in the dataset?

In this segment it became obvious that the Scores were less affected by Out-of-School Study Time and Learning Time than anticipated. For Learning Time in school, we saw that Science had a more certain relationship with every one of the Scores than the Math and Reading Learning Times

The scores were anyway firmly related to the Educational level of the parents. We saw that the higher the level of education of either the mother or father, the higher the score of the student is bound to be, on normal at any rate. Likewise, we saw that the female students somewhat beat the male students on the Average Reading Score, however for the most part the females and males played out the equivalent all through.

Did you observe any interesting relationships between the other features (not the main feature(s) of interest)?

Curiously, Out-of-School Study Time and Learning Time were not as huge as I had anticipated. Specifically, we can see that the only significant and positively correlated Out-of-School Study Time variable was Homework, and the rest were correlated in a powerless negative manner to the student's score.

Multivariate Exploration

To get going this segment of investigation, we should proceed with the box plots and gender examinations from previously..

In [61]:
plt.figure(figsize=[14,8])
sb.boxplot(data = pisa, 
            x = 'Education - Father', 
            y = 'Average_Total_Score',
            hue = 'Gender',
            palette = ['skyblue', 'violet']);
plt.xticks(rotation = 12)
plt.legend(loc = 'upper left', fontsize= 'x-large');
In [62]:
plt.figure(figsize=[14,8])
sb.boxplot(data = pisa, 
              x = 'Education - Mother', 
              y = 'Average_Total_Score',
              hue = 'Gender',
              palette = ['skyblue', 'violet']);
plt.xticks(rotation = 12)
plt.legend(loc = 'upper left', fontsize= 'x-large');

Here we answer one of the first inquiries of whether there contrasts in accomplishment dependent on gender or parental education levels. For both Father and Mother, we can see an irrelevant contrast among males and females for all levels. The amplest hole between the two genders exists for the Essential education level for both Father and Mother, yet the extent of students in this class is little, and the medians are all things considered comparative enough.

Also, with regards to the educational levels of the parents, well those certainly assume a part in how effective an student will in general be. There is obviously an emotional spread in the two ways and outliers, however it appears to bwe can notice the connection between Learning Times and their particular subjects.e that the middle Score for students is firmly identified with the instructive level of one or the other Mother or Father.

Now we can notice the connection between Learning Times and their particular subjects.

In [63]:
# Faceted scatter plots on levels of Father's education 'Sciecne'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Science_Score', 'Learning Time - Science', 
      color = 'mediumturquoise',  x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Science Score')
g.set_ylabels('Learning Time(mins/week)- Science')

plt.show();

Beforehand, we saw that the measure of Learning Time for Science looked encouraging when it went to its connection to its relating Score, the Normal Science Score, at any rate in contrast with different sets. In any case, when we take a gander at the relapse plots we see here, we can see there may be a partition between the students. The line of regression appears to be showing a negative correlation between Learning Time for Science and the Average Science Score for the students whose Fathers achieved Primary,Lower secondary, and Upper secondary education. Then again, with the 3 most elevated levels of education in our dataframe, Post-secondary, Short-cycle tertiary, and Bachelor's or same, we can see a positive connection. This may demonstrate that the higher the education of the father, the almost certain that Science related Learning Time in school will create a higher evaluation.

In [64]:
# Faceted scatter plots on levels of Mother's education 'Science'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Science_Score', 'Learning Time - Science', color = 'violet',  x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Science Score')
g.set_ylabels('Learning Time(mins/week)- Science')

plt.show();

To set add backing to the contention that the more Science related Learning Time in school there is, the better the Science Score of the student will be if the parental education is Post-secondary or higher, we can see that the outcomes for the Mother's education match.

Considering this, it would be intriguing on the off chance that we saw comparable outcomes for the Science and Reading related scores.

In [65]:
# Faceted heat maps on levels of Father's education 'Math'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Math_Score', 'Learning Time - Mathematics', color = 'mediumturquoise', x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Math Score')
g.set_ylabels('Learning Time(mins/week)- Math')

plt.show();
In [66]:
# Faceted scatter plot on levels of Mothers's education 'Math'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Math_Score', 'Learning Time - Mathematics', color = 'violet', x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Math Score')
g.set_ylabels('Learning Time(mins/week)- Math')

plt.show();

Thinking about the outcomes for both Mother and Father, the outcomes are awfully unspectacular. We can't close a similar connection as we could for the Science Learning Time and Score relationship. Here, the measure of Learning Time for Science doesn't appear to assume a part in the Mathematical Score for a kid.

In [67]:
# Faceted scatter plot on levels of Father's education 'Reading, Test Language'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Reading_Score', 'Learning Time - Test Language', color = 'mediumturquoise', x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Reading Score')
g.set_ylabels('Learning Time(mins/week)- Test Language')

plt.show();
In [68]:
# Faceted scatter plot on levels of Mother's education 'Reading, Test Language'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Reading_Score', 'Learning Time - Test Language', color = 'violet', x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Reading Score')
g.set_ylabels('Learning Time(mins/week)- Test Language')

plt.show();

Similarly as we saw for the Math Learning Time and Score, we can see the equivalent for Reading Score and Learning Time of the Test Language. There are no unmistakable patterns and we can't presume that the Learning Time assumes a part in the accomplishment in the Reading Score.

So for the Learning Times, we can reason that Science related Learning Time had the greatest impact on its comparing Score, and the other two are unimportant.

Presently we can move onto Out-of-School Study Time. Already, there was not many promising outcomes out of the investigation, so how about we check whether dissecting the parental education levels may change the outcomes.

In [69]:
# Faceted scatter plot on levels of father's education with 'Study Time - Total'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Total', 
      color = 'mediumturquoise', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Total')

plt.show();
In [70]:
# Faceted scatter plot on levels of father's education with 'Study Time - Total'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Total', 
      color = 'violet', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Total')

plt.show();

Here we can see the All Out-of-School Study Time versus the Average Total Score. It's exceptionally evident that there is no important connection between these two. We can investigate every one of the factors that made up the Total Out-of-School Study Time to check whether there are any perceptible connections.

In [71]:
# Faceted scatter plot on levels of father's education 'Study Time - Guided Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Guided Homework', 
      color = 'mediumturquoise', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Guided Homework')

plt.show();
In [72]:
# Faceted scatter plot on levels of father's education 'Study Time - Guided Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Guided Homework', 
      color = 'violet', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Guided Homework')

plt.show()

The connection between Guided Homework Study Time and the All out Score doesn't look great. Indeed, we see an unpretentious negative relationship for each Level of Education for the two Fathers and Mothers.

In [73]:
# Faceted scatter plot on levels of father's education 'Study Time - Personal Tutor'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Personal Tutor', 
      color = 'mediumturquoise', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Personal Tutor')

plt.show();
In [74]:
# Faceted scatter plot on levels of father's education 'Study Time - Personal Tutor'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Personal Tutor', 
      color = 'violet', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Personal Tutor')

plt.show();

The equivalent can be said for the Personal Tutors and Score. This could be obviously because of the way that students who need additional time with Personal Tutors are now the ones who battle, yet that is a case that is a little to enormous for this data investigation.

In [75]:
# Faceted scatter plot on levels of father's education 'Study Time - Commercial Company'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Commercial Company', 
      color = 'mediumturquoise', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Commercial Company')

plt.show();
In [76]:
# Faceted scatter ploton levels of father's education 'Study Time - With Parent'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - With Parent', 
      color = 'mediumturquoise', 
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - With Parent')

plt.show();

For students Study Time with either a Commercial Company or with a Parent, we can see the very pattern that we saw for Guided Homework and Personal Tutor, so the need to see it applied to Fathers educational levels, just as the Mothers, isn't important. Indeed we can see a little negative connection, demonstrating that assuming the student requires more Study Time, it won't ensure a higher Score.

Also, to wrap things up, the most encouraging variable of the Out-of-School Study Time gathering: Homework.

In [77]:
# Faceted scatter plot on levels of father's education 'Study Time - Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Homework', color = 'mediumturquoise',
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Homework')

plt.show();

Here we have an extremely clear relationship that demonstrates that the additional time an student spends on Homework, the higher their Total Score will be. This is relevant for each educational level for the father, and it is a serious enormous differentiation to the wide range of various Out-of-School Study Time factors.

In [78]:
# Faceted scatter plot on levels of mather's education 'Study Time - Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Mother', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Total_Score', 'Out-of-School Study Time - Homework', color = 'violet',
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'fuchsia'})
g.set_xlabels('Average Total Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Homework')

plt.show();

Similarly just like the case for the father, the mothers levels of education all demonstrate a similar positive connection between Homework related Study Time and Total Score.

As a last investigation, we can take a gander at the fathers level of education in contrast with the three Scores that the Total Score is involved.

In [79]:
# Faceted scatter plot on levels of fathers education 'Average Science Score : Study Time - Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Science_Score', 'Out-of-School Study Time - Homework', color = 'mediumturquoise',
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Science Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Homework')

plt.show();
In [80]:
# Faceted scatter plot on levels of father's education 'Average Math Score : Study Time - Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Math_Score', 'Out-of-School Study Time - Homework', color = 'mediumturquoise',
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Math Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Homework')

plt.show();
In [81]:
# Faceted scatter plot on levels of father's education 'Average Reading Score : Study Time - Homework'
g = sb.FacetGrid(data = pisa, col = 'Education - Father', col_wrap = 4, height = 5)
g.map(sb.regplot, 'Average_Reading_Score', 'Out-of-School Study Time - Homework', color = 'mediumturquoise',
      x_jitter = 0.3,
      scatter_kws = {'alpha' : 1/20}, 
      line_kws={"color": 'lightseagreen'})
g.set_xlabels('Average Reading Score')
g.set_ylabels('Out-of-School Study Time (h/week) - Homework')
plt.show();

Talk about some of the relationships you observed in this part of the investigation. Were there features that strengthened each other in terms of looking at your feature(s) of interest?

All through this part, we examined further into what sort of impact parental education has on the scores of the students. Specifically, we got going by checking whether there was a distinction between the gender of an student and how well they scored, comparable to their parental level of education. For both mother's and father's level of education, we saw consistency between the genders with the exception of extremely irrelevant contrasts.

Then, we proceeded to see the connection between Learning Times and their particular subjects. As we found in the bivariate Analysis, Learning Time spent on Science had the best results, however there was a trick. I will proceed with this point in the inquiry underneath. Concerning the rest, the relationship was immaterial and no relationship could be set up.

Lastly, we took a gander at the connection between the Out-of-School Study Times and the Average Total Scores. This was similarly insignificant for all classes with the exception of one: Homework. We proceeded to see Homework in contrast with every one of the scores that the Average Total Score was made out of, and the positive relationship endured. I would in any case order it as a frail relationship, however it all things considered was there.

Were there any interesting or surprising interactions between features?

The most striking finding was the distinction between students scores across parental levels of education when contrasting with Learning Time for Science. It showed that in spite of the fact that learning time for Science appears as though a variable that would expand an students score in Science, we can't accept that it is the situation for students altogether conditions. We found that for students with parents of lower educational levels, investing more energy in school learning Science related themes didn't have the positive connection that we saw with the scores for the students with parents of higher educational levels. Accordingly, students who invested more energy learning science in school possibly had an obvious advantage when their parents had post-secondary education or higher.